Skip to main content

Configuration Variable - STRIP_TRAILING_SPACES

  • July 13, 2011
  • 11 replies
  • 0 views

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

11 replies

  • Author
  • Rocketeer
  • 19312 replies
  • July 13, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

Hello,

Could you sent me the SELECT, the FD of your file ?
On which OS are you using ACUCOBOL-GT ?

Roch Rolland
Ingénieur Micro Focus

  • Author
  • Rocketeer
  • 19312 replies
  • July 13, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

Hi Roch,
Thanks for responding.
Here is my select and fd:
SELECT NACHA-FILE ASSIGN TO NACHA-FILE-NAME
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS NACHA-STATUS.

FD NACHA-FILE
VALUE OF FILE-ID IS NACHA-FILE-NAME
* block contains 94 characters
* RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
* DEPENDING ON 94-CHAR-VARIABLE
LABEL RECORDS ARE STANDARD.
01 NACHA-RECORD PIC X(94).

We are using Windows xp, Windows 2xxx Server & W7.




Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • July 13, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
will make a variable length
RECORD Contains 94 CHARACTERS
will make a fixed length

  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

I've tried "Record Contains 94 characters".
It still stripped out the trailing spaces.
I have SET ENVIRONMENT "STRIP_TRAILING_SPACES" TO 0 in the program before opening the file for output.


  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

I've tried "Record Contains 94 characters".
It still stripped out the trailing spaces.
I have SET ENVIRONMENT "STRIP_TRAILING_SPACES" TO 0 in the program before opening the file for output.


  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

I compiled and ran this program and it did not strip the trailing spaces:
       PROGRAM-ID.  lineseq.
       FILE-CONTROL.
           select lineseq
                  assign to "lineseq.txt"
                  organization is line sequential
                  file status is fs.
       FILE SECTION.
       fd lineseq.
       01 lineseq-rec pic x(15).
       WORKING-STORAGE SECTION.
       01 fs pic xx.
       PROCEDURE DIVISION.
       MAIN.
           open output lineseq.
           move "test data      " to lineseq-rec.
           write lineseq-rec.
           close lineseq.
           stop run.


Note that if any of the file's WRITE statements include the AFTER phrase the file is seen as a PRINT file and the trailing spaces will always be stripped.

  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

Enclosed is my test program.
i do have a work around which is to shell out to a vb program, but i rather not do that if i can handle this within the cobol program.


IDENTIFICATION DIVISION.
PROGRAM-ID.  testTrailingSpaces.

DATE-COMPILED.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.

FILE-CONTROL.

    select test-file assign to test-file-name
                ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.
FILE SECTION.
fd test-file
    COPY 'Q:VALUE.FD'. test-file-name
    record contains 94 characters
*    RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
*        DEPENDING ON 94-CHAR-VARIABLE
    LABEL RECORDS ARE STANDARD.
01 test-record                        pic x(80).

WORKING-STORAGE SECTION.
01 94-CHAR-VARIABLE    pic 9(6) value 80.
01 padd-char        pic x value "9".
01 test-file-name    pic x(100).
/*-----------------------------------------------------------
PROCEDURE DIVISION.
100-MAIN.

    perform 600-test-strip-trailing-spaces.
    
    stop run.

600-test-strip-trailing-spaces.

    SET ENVIRONMENT "STRIP_TRAILING_SPACES" TO 0.
    move 'nacha.txt' to test-file-name.

    open output test-file.
    
    move "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234" to test-record.
    write test-record before advancing 1 line.
    move "this is second line                                                                           " to test-record.
    write test-record before advancing 1 line.
    move "this is third line " to test-record.
    write test-record before advancing 1 line.

    close test-file.
        

  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

You have the BEFORE phrase on the WRITE statements, which causes the same behavior as AFTER. The file is seen as a print file and the trailing spaces will always be stripped. The BEFORE phrase is really not necessary for a line sequential file. Try removing the BEFORE phrase.

  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

Problem solved! Thanks DougP!
It has to do with "before advancing 1 line" in "Write test-record before advancing 1 line".

I've used "before advancing 1 line" because it used to insert a crlf before the first line when i didn't have the "before advancing" line.

This may sound confusing but not having any "before advancing" in any WRITE line as in DougP example, the output looks correct without the initial crlf in the first line; however, if i have a "before advancing" in any of the WRITE line, the system inserts a crlf in the first line???

i just like to know why the system is differentiating the two?

Thanks again.


  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

DougP, you are too quick!!!
Thanks!!!

  • Author
  • Rocketeer
  • 19312 replies
  • July 14, 2011

[Migrated content. Thread originally posted on 12 July 2011]

I can't seem to write line sequential file with 94 character with WITHOUT stripping the trailing spaces.
I have set the STRIP_TRAILING_SPACES to 0;
I've tried using BLOCK CONTAINS 94 CHARACTERS in FD section
I've tried RECORD IS VARYING IN SIZE FROM 1 TO 94 CHARACTERS
DEPENDING ON 94-CHAR-VARIABLE in FD section.

Using AcuCobol 8.01.
FYI, Wring a NACHA file for Direct Deposit transfer, and bank wants every record to be exactly 94 character without losing the trailing spaces.

Thanks for help in advance.

DougP, you are too quick!!!
Thanks!!!