Posted: Wed Apr 20, 2016 9:43 am Post subject: Update existing record w/multiple totals.
Hello, I'd appreciate someone's help to find a solution.
There's a flat file, FB, LRECL=341.
File has 1 header record followed by data records.
Header record is identified by '9' in position 1, and besides other data, has 3 totals.
1.Total number of recs, excluding header = pos 20, x(9).
2.Total number of balanced accounts (space in pos 23 of data record) = pos 30, x(9).
3.Total number of unbalanced accounts (value other that space in pos 23 of data record) = pos 39, x(9).
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Apr 20, 2016 12:30 pm Post subject:
ramy2016,
Use the following JCL to get the desired results. Btw your position for total record is off. I think it should start at 21 instead of 20 which you show.
Code:
//******************************************************************
//* GENERATE SYMBOLS FOR TOTAL RECORDS, BALANCED RECORD COUNT AND *
//* UNBALANCED RECORD COUNT *
//******************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your Input 341 lrecl file
//SORTOUT DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
OPTION COPY
OMIT COND=(1,1,CH,EQ,C'9')
kolusu, thank you.
The step0100 works like a charm, but step0200 from what I can see, just creates updated header in the step sortout, but the header on the file is not updated.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Apr 20, 2016 2:30 pm Post subject:
ramy2016 wrote:
kolusu, thank you.
The step0100 works like a charm, but step0200 from what I can see, just creates updated header in the step sortout, but the header on the file is not updated.
Do you want to update the existing dataset? If so you need to do it differently _________________ Kolusu
www.linkedin.com/in/kolusu
Almost there
The UBL-COUNT calculates number of unbalanced + 1.
Could that be related to TOT-COUNT also having an extra count, but you even it out by COUNT-1 before storing?
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Apr 20, 2016 6:32 pm Post subject:
ramy2016 wrote:
Almost there
The UBL-COUNT calculates number of unbalanced + 1.
Could that be related to TOT-COUNT also having an extra count, but you even it out by COUNT-1 before storing?
Ramy2016,
I am not sure if you had noticed that I have made changes to STEP0100 Control cards(4 CHANGE statements vs 2 Change Statements) for accounting the record header record.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum