View previous topic :: View next topic
|
Author |
Message |
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
Hello,
I am having a requrement to extract the data
form the file to generate the report :-
INPUT FILE:-
Record format . . . : FB
Record length . . . : 80
Code: |
CA ACC01 1020
GA ACC02 1020
CA ACC03 8922
CA ACC04 8924
GA ACC08 8924
CA ACC00 8393
CA ACC06 9893
CA ACC70 8935
GA ACC89 8935 |
REPORT :-
Code: |
CA AMT GA AMT
-- ---- ---- ----
ACC01 1020 ACC02 1020
ACC03 8922
ACC04 8924 ACC08 8924
ACC00 8393
ACC06 9893
ACC70 8935 ACC89 8935 |
Rules:--
The records are in a sequence whenever
there is a GA record after CA then
the records should merge as depicted
above.
Thank you,
Rajat |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What if there are 50 2-char values (i.e. CA, GA, FG, HY, etc) and the data is too wide for a report line? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Rajat,
Assuming you only have 'CA' and "GA' records as shown, you can use a DFSORT/ICETOOL job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//IN DD *
CA ACC01 1020
GA ACC02 1020
CA ACC03 8922
CA ACC04 8924
GA ACC08 8924
CA ACC00 8393
CA ACC06 9893
CA ACC70 8935
GA ACC89 8935
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) KEEPNODUPS -
WITH(18,5) WITH(26,4) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'CA'),
PUSH=(81:ID=8)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'CA'),
BUILD=(1:7,5,9:15,5,81:81,8)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'GA'),
BUILD=(18:7,5,26:15,5,81:81,8))
OUTFIL FNAMES=OUT,REMOVECC,BUILD=(1,80),
HEADER2=('CA AMT GA AMT',/,
'-- ---- ---- ----')
/*
|
|
|
Back to top |
|
|
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
Hello,
We have one only two char values CA and GA .
Thank You,
Rajat |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Then the solution I provided should work for you. |
|
Back to top |
|
|
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
Hello,
Thanks a lot, It is giving me the expected results. Please explain me the below coded statement in your JCL
Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'CA'),
PUSH=(81:ID=8)), |
Rajat |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
|
|