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

Can DFSORT rolled up records by a fixed field?


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

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Dec 05, 2007 2:00 am
Reply with quote

I would like to know if DFSORT can help me with a requirement. 80 byte records coming in, 80 byte records going out.

Here is the input:

Code:

XX0161   #CPIUSER
XX0161   CREA   
XX0161   DFLTGRP1
XX0161   EDIADMIN
XX0161   MBIC   
XX0161   NVUSER 
XX0287   #CPIUSER
XX0287   CREA   
XX0287   DFLTGRP1
XX0287   EDIADMIN
XX0287   MBIC   
XX0287   NVUSER 
XX0380   #CPIUSER
XX0380   CRPSS   
XX0380   DFLTGRP1
XX0380   NVUSER 
XX0380   OPER   
XX0380   P0140RO
XX0380   P0983RO
XX0380   RDSGRP
XX0380   SPAP
XX0380   ZEKEADMN


Here is what I expect the output to look like:

Code:

XX0161   #CPIUSER CREA     DFLTGRP1 EDIADMIN MBIC     NVUSER           
XX0287   #CPIUSER CREA     DFLTGRP1 EDIADMIN MBIC     NVUSER           
XX0380   #CPIUSER CRPSS    DFLTGRP1 NVUSER   OPER     P0140RO  P0983RO
XX0380   RDSGRP   SPAP     ZEKEADMN                                   


What follows each XX???? ID are groups. They can be up to 8 positions long. When rolling up, there should be only a maximum of 7 groups per line beginning in positions 10, 19, 28, 37, 46, 55, and 64. If there are more than 7 groups listed for an ID, a new line should started.

Thanks in advance...Scott
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: Wed Dec 05, 2007 3:28 am
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed that the records were already in sorted order by positions 1-6 as shown in the example. I assumed that the input file has RECFM=FB and LRECL=80. The job can be changed appropriately if these assumptions are incorrect.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(90,8,ZD) KEEPNODUPS -
  WITHEACH WITH(19,8) WITH(28,8) WITH(37,8) WITH(46,8) -
  WITH(55,8) WITH(64,8) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(81:10,8,10:8X,106:SEQNUM,8,ZD,START=0,RESTART=(1,6),
    89:106,8,ZD,MOD,+7,TO=ZD,LENGTH=1)),
   IFTHEN=(WHEN=INIT,OVERLAY=(90:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(89,1,ZD,EQ,+0),
                OVERLAY=(90:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(98:SEQNUM,8,ZD,
                         90:90,8,ZD,SUB,98,8,ZD,TO=ZD,LENGTH=8))
  OUTREC IFOUTLEN=97,
    IFTHEN=(WHEN=(89,1,ZD,EQ,+0),OVERLAY=(10:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+1),OVERLAY=(19:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+2),OVERLAY=(28:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+3),OVERLAY=(37:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+4),OVERLAY=(46:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+5),OVERLAY=(55:81,8)),
    IFTHEN=(WHEN=(89,1,ZD,EQ,+6),OVERLAY=(64:81,8))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Dec 05, 2007 9:48 am
Reply with quote

Hi Frank,
when I try the following data I don't seem to get the desired results.

The problem seems to be when there is a single group or 8 groups or 15 groups etc
Code:
XX0157   01ONLYA     
XX0158   08ONLYA     
XX0158   08ONLYB     
XX0158   08ONLYC     
XX0158   08ONLYD     
XX0158   08ONLYE     
XX0158   08ONLYF     
XX0158   08ONLYG     
XX0158   08ONLYH     

Results
Code:
XX0158   08ONLYA  08ONLYB  08ONLYC  08ONLYD  08ONLYE  08ONLYF  08ONLYG


Gerry
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Wed Dec 05, 2007 12:40 pm
Reply with quote

Hi gcicchet,

Just add 'KEEPNODUPS' in the splice card and execute.
You will get the desired output.

I executed with KEEPNODUPS and i got the output which i mention below.

I/P
Code:

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
****** ***************************** Top of Data *****************************
000001 XX0001   XX0001G1                                                     
000002 XX0002   XX0002G1                                                     
000003 XX0002   XX0002G2                                                     
000004 XX0003   XX0003G1                                                     
000005 XX0003   XX0003G2                                                     
000006 XX0003   XX0003G3                                                     
000007 XX0007   XX0007G1                                                     
000008 XX0007   XX0007G2                                                     
000009 XX0007   XX0007G3                                                     
000010 XX0007   XX0007G4                                                     
000011 XX0007   XX0007G5                                                     
000012 XX0007   XX0007G6                                                     
000013 XX0007   XX0007G7                                                     
000014 XX0008   XX0008G1                                                     
000015 XX0008   XX0008G2                                                     
000016 XX0008   XX0008G3                                                     
000017 XX0008   XX0008G4                                                       
000018 XX0008   XX0008G5                                                       
000019 XX0008   XX0008G6                                                       
000020 XX0008   XX0008G7                                                       
000021 XX0008                                                                 
000022 XX0009   XX0009G1                                                       
000023 XX0009   XX0009G2                                                       
000024 XX0009   XX0009G3                                                       
000025 XX0009   XX0009G4                                                       
000026 XX0009   XX0009G5                                                       
000027 XX0009   XX0009G6                                                       
000028 XX0009   XX0009G7                                                       
000029 XX0009   XX0009G8                                                       
000030 XX0009   XX0009G9                                                       
****** **************************** Bottom of Data ****************************


O/P

Code:

 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 ****** ***************************** Top of Data ******************************
 000001 XX0001   XX0001G1                                                       
 000002 XX0002   XX0002G1 XX0002G2                                             
 000003 XX0003   XX0003G1 XX0003G2 XX0003G3                                     
 000004 XX0007   XX0007G1 XX0007G2 XX0007G3 XX0007G4 XX0007G5 XX0007G6 XX0007G7
 000005 XX0008   XX0008G1 XX0008G2 XX0008G3 XX0008G4 XX0008G5 XX0008G6 XX0008G7
 000006 XX0008                                                                 
 000007 XX0009   XX0009G1 XX0009G2 XX0009G3 XX0009G4 XX0009G5 XX0009G6 XX0009G7
 000008 XX0009   XX0009G8 XX0009G9                                             
 ****** **************************** Bottom of Data ****************************


Just verify.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Dec 05, 2007 8:01 pm
Reply with quote

Frank..Thank you for your solution. I am becoming a believer that ICETOOL/DFSORT can do just about anything to manipulate data. I would have never been able find a solution using the manual after seeing your rather complex solution.

Also, thanks to gcicchet for testing your solution and also much thanks to ibmmainframesyntel for the final KEEPNODUPS suggestion that made the output perfect. Without KEEPNODUPS, I had 1098 records on my output file. With KEEPNODUPS, the total output records was 1161 that took into account records that were missing because those IDs were associated with 8 or 15 groups each (where the last group was not being accounted for).
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: Wed Dec 05, 2007 10:26 pm
Reply with quote

cpuhawg,

I tested with the input you gave me. Unfortunately, I didn't think to test other variations or I would have realized KEEPNODUPS was needed. I just got in and saw the new posts and that ibmmainframesyntel figured it out (saves me the trouble). I've modified the job to use KEEPNODUPS for future reference.
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 Store the data for fixed length COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top