Variable Length Record - S0C4



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Variable Length Record - S0C4

Postby Number1Ump » Thu Dec 01, 2011 9:43 pm

Hello all.

I have the following file definitions:

FILE FILEIN V 1046
FILEIN-RECORD 1 1046 A
FILEIN-FILLER1 1 25 A
FILEIN-BH 26 2 A
FILEIN-FILLER2 28 19 A
FILEIN-HDRDTE 43 8 A
FILEIN-TRAN-DT 47 6 A
FILEIN-FILLER3A 400 10 A
FILEIN-FILLER3 53 994 A
FILE FILEOUT V 1046
FILEOUT-RECORD 1 1046 A

Logic:

JOB INPUT (FILEIN)
WK-IN-LEN = FILEIN:RECORD-LENGTH
IF FILEIN-BH EQ 'BH'
MOVE '03/03/05' TO FILEIN-HDRDTE
GOTO EOJ-END
ELSE-IF FILEIN-BH EQ 'BT'
GOTO EOJ-END
ELSE
MOVE '010203' TO FILEIN-TRAN-DT
END-IF
EOJ-END
FILEOUT-RECORD = FILEIN-RECORD
FILEOUT:RECORD-LENGTH = WK-IN-LEN
PUT FILEOUT


At a certain point in the processing of the input file, we hit a S0C4 on the FILEOUT-RECORD = FILEIN-RECORD. We are not at EOF, so is there any other thoughts?
Number1Ump
 
Posts: 6
Joined: Thu Dec 01, 2011 9:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable Length Record - S0C4

Postby BillyBoyo » Thu Dec 01, 2011 10:24 pm

Number1Ump wrote:Hello all.

I have the following file definitions:

FILE FILEIN   V 1046                   
     FILEIN-RECORD     1 1046   A     
       FILEIN-FILLER1  1   25   A     
       FILEIN-BH       26   2   A     
       FILEIN-FILLER2  28  19   A     
       FILEIN-HDRDTE   43   8   A     
       FILEIN-TRAN-DT  47   6   A     
       FILEIN-FILLER3A 400 10   A     
       FILEIN-FILLER3  53 994   A     
FILE FILEOUT  V 1046                   
     FILEOUT-RECORD    1 1046   A     


Logic:

JOB INPUT (FILEIN)                           
    WK-IN-LEN = FILEIN:RECORD-LENGTH         
    IF FILEIN-BH EQ 'BH'                     
       MOVE '03/03/05' TO FILEIN-HDRDTE       
       GOTO EOJ-END                           
    ELSE-IF FILEIN-BH EQ 'BT'                 
       GOTO EOJ-END                           
    ELSE                                     
    MOVE '010203' TO FILEIN-TRAN-DT           
    END-IF                                   
EOJ-END                                       
    FILEOUT-RECORD = FILEIN-RECORD           
    FILEOUT:RECORD-LENGTH = WK-IN-LEN         
    PUT FILEOUT                               


At a certain point in the processing of the input file, we hit a S0C4 on the FILEOUT-RECORD = FILEIN-RECORD. We are not at EOF, so is there any other thoughts?



Easytrieve plus can do "assignments" and "moves".

You have used a mixture of the two.

What I prefer is "assignments", with "=", to differentiate from the IFs. I avoid the MOVEs so it looks as little like Cobol as possible, because thinking in Cobol ways can be a problem.

In this particular case, you'd get the same problem in Cobol.

One place in Easytrieve plus where I use MOVE is with files, because MOVE always uses the record-length when using files.

You have come to the end of a block, with a record that is less than 1046 bytes. You have been prevented from accessing storage beyond the end of the block. S0C4.

MOVE FILEIN TO FILEOUT

in place of

FILEOUT-RECORD = FILEIN-RECORD


You don't need to save your record-length to assign it later.

I've never used a GO TO other than GO TO JOB in Easytrieve plus. There is no need to with your code either.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Variable Length Record - S0C4

Postby Number1Ump » Fri Dec 02, 2011 12:29 am

In all the years I've worked with EZT, I have never seen the move one FILE to another FILE but that worked so well. Thanks for the reply and the help!
Number1Ump
 
Posts: 6
Joined: Thu Dec 01, 2011 9:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Variable Length Record - S0C4

Postby BillyBoyo » Fri Dec 02, 2011 2:53 am

No problem. Thanks for letting known.

The MOVE filename is in the manual. You were a new poster on this Beginners and Students site, so I didn't know of your amount of experience. I'd have probably kept quiet about the other tips...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post