easytrieve problem



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

Re: easytrieve problem

Postby dick scherrer » Sun Jul 05, 2009 6:06 am

Hello,

Believe you need to study the way this code will operate. . .

I suspect that the error is reading after the end of file.

Why is there a perform of aa000 from within bb000? Why is there a perform of aa000 immediately before the aa000 proc statement?

Look at the sample code and make sure your code is logically the same.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: easytrieve problem

Postby nosource » Fri Aug 28, 2009 9:48 pm

Not sure if you've solved this problem. If not, how about a slightly different design? I'd suggest using the automatic file synchronization.

Because sync processing needs the input files in the same sequence...

Read your INFILE file and output the record 'as is' Plus add one field, either at the beginning or end, where you put in a sequence number.
JOB INPUT INFILE
MOVE ' ' TO OUT-REC FILL X'40'. * clear output record
OUT-REC-PART1 = IN-REC
OUT-SEQ-NBR = INFILE:RECORD-COUNT
PUT OUTFILE
GO TO JOB

If your Master file is not sorted by CUST-ID... Define a VIRTUAL one (next to all of the other FILE stmts) and SORT it...
*----------------------------------------------------------------------*
* VIRTUAL MASTER FILE *
*----------------------------------------------------------------------*
FILE MSTRTEMP F 512 VIRTUAL
COPY MSTRFILE. * AUTOMATICALLY USES THE SAME LAYOUT AS MSTRFILE WITHOUT RECODING


SORT MSTRFILE TO MSTRTEMP USING (MSTR-CUST-ID)

Sort the OUTFILE (from above)... output will overlay itself.
SORT OUTFILE TO OUTFILE USING (OUT-CUST-ID)

Synchronize process the files...
JOB INPUT (OUTFILE KEY (OUT-CUST-ID) +
MSTRTEMP KEY (MSTR-CUST-ID) +
) +
START INIT-PROC +
FINISH TERM-PROC

IF MATCHED
OUT-CUST-ID = MSTRTEMP:MSTR-CUST-ID. * you have to qualify the MSTR-CUST-ID since it's defined in two FILEs.
END-IF
OUTFILE2-REC = OUTFILE-REC
PUT OUTFILE2-REC
GO TO JOB

Resort the resulting OUTFILE2 file by SEQ-NBR (your requirement was to have the resulting file the same sequence as it started out in)
SORT OUTFILE 2TO OUTFILE2 USING (OUT-SEQ-NBR)

Strip off the SEQ-NBR
JOB INPUT OUTFILE2
MOVE ' ' TO OUT2-REC FILL X'40'
OUT2-REC-PART1 = OUTFINAL-REC
PUT OUTFINAL
GO TO JOB


Hope this helps.
nosource
 
Posts: 4
Joined: Fri Aug 28, 2009 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: easytrieve problem

Postby nosource » Fri Aug 28, 2009 9:54 pm

After rereading my post I realized that the comment about defining the VIRTUAL file may be misleading.

Define the file up at the beginning of the program along with the other FILE statements. Code the SORT after 'GO TO JOB' statement at the end of the first process (JOB INPUT INFILE).
nosource
 
Posts: 4
Joined: Fri Aug 28, 2009 8:13 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post