IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Report generation problem


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri May 07, 2010 12:46 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 07, 2010 7:26 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 07, 2010 11:02 pm
Reply with quote

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
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri May 07, 2010 11:03 pm
Reply with quote

Hello,

We have one only two char values CA and GA .

Thank You,
Rajat
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 07, 2010 11:04 pm
Reply with quote

Then the solution I provided should work for you.
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri May 07, 2010 11:20 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 07, 2010 11:43 pm
Reply with quote

For complete details on DFSORT's WHEN=GROUP function, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000085
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts Creating Report using SORT DFSORT/ICETOOL 7
No new posts Started task using a generation dataset JCL & VSAM 7
Search our Forums:

Back to Top