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

Need help in Sort [moving fields one level up]


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

New User


Joined: 27 Oct 2009
Posts: 2
Location: Lynchburg

PostPosted: Thu Dec 10, 2009 1:31 am
Reply with quote

I have the following scenario:

Input: [Sequential DS]

101 00AA 00BB
101 00CC 00DD
101 00EE 00FF
101 00GG 00HH
201 00II 00JJ
201 00KK 00LL
201 00MM 00NN

I need to add an extra column with the values shifted from the previous record [from 4th byte on],also for every change of value in the first 3 bytes,the process should be restarted as follows:

Output:

101 00AA 00BB 00CC
101 00DD 00EE 00FF
101 00GG 00HH
201 00II 00JJ 00KK
201 00LL 00MM 00NN

Could this be done thru DFSORT/ICETOOL/ICEMAN?

Please send your thoughts.
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: Thu Dec 10, 2009 2:28 am
Reply with quote

What is the RECFM and LRECL of the input file?

What is the starting position, length and format of each input field and each output field?

It appears that you want to change from groupings of two fields for each key to groupings of three fields for each key
(e.g. A B/C D/ E F to A B C/D E F) - is that correct?
Back to top
View user's profile Send private message
vimalrajendran

New User


Joined: 27 Oct 2009
Posts: 2
Location: Lynchburg

PostPosted: Thu Dec 10, 2009 2:52 am
Reply with quote

Hi Frank,
Thanks for the quick response.

The RECFM is FB and the LRECL is 80 Bytes.

I/P Record:
101 00AA 00BB

101 - 1,3,CH [Starting pos,Length,Format]
00AA - 4,4,CH
00BB - 8,4,CH

O/P Record:
101 00AA 00BB 00CC

101 - 1,3,CH
00AA - 4,4,CH
00BB - 8,4,CH
00CC - 12,4,CH

Yes correct,I need to have 3 groupings of 3 fields instead of 2 groupings of 2.

Do let me know if you need any more details.
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 Dec 11, 2009 2:02 am
Reply with quote

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=*
//IN DD *
10100AA00BB
10100CC00DD
10100EE00FF
10100GG00HH
20100II00JJ
20100KK00LL
20100MM00NN
30100XX00YY
40100ZZ
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(90,8,ZD) -
   WITHEACH WITH(8,4) WITH(12,4) -
   KEEPNODUPS USING(CTL2)
/*
//CTL1CNTL DD *
 OUTFIL FNAMES=T1,BUILD=(1,3,4,4,80:X,/,1,3,8,4)
/*
//CTL2CNTL DD *
 OPTION COPY
 INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(81:SEQNUM,8,ZD,START=0,RESTART=(1,3),
             89:81,8,ZD,MOD,+3,TO=ZD,LENGTH=1)),
   IFTHEN=(WHEN=GROUP,BEGIN=(89,1,ZD,EQ,0),PUSH=(90:ID=8)),
   IFTHEN=(WHEN=(89,1,ZD,EQ,1),OVERLAY=(8:4,4)),
   IFTHEN=(WHEN=(89,1,ZD,EQ,2),OVERLAY=(12:4,4))
 OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Alternative of JoinKeys in SORT DFSORT/ICETOOL 2
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts Simplify SORT CARD to combine INREC a... DFSORT/ICETOOL 6
No new posts Sort card to generate the DSN DFSORT/ICETOOL 17
Search our Forums:


Back to Top