MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
subhasis_50 Beginner Joined: 17 Jun 2005 Posts: 4 Topics: 3 Location: KOLKATA,India
Posted: Sat Nov 03, 2018 3:21 pm Post subject: can it be done in sort (vertical to horizontal
Hi,
Can it be done in sort. Need to sort and reformat vertical to horizontal.
Input:
Code:
11111111111111,A,S,CP,20080520,20081203,CR
11111111111111,B,T,CR,20080521,20081204,DR
11111111111112,A,S,CP,20080520,20081203,CK
11111111111112,B,T,CR,20080521,20081204,DK
Output: Code:
11111111111111,A,S,CP,20080520,20081203,CR,B,T,CR,20080521,20081204,DR
11111111111112,A,S,CP,20080520,20081203,CK,B,T,CR,20080521,20081204,DK
Key is 1st 14 bytes. There can be maximum 6 occurrence for any key. _________________ Thanks & Regards
Subhasis
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Sat Nov 03, 2018 7:30 pm Post subject:
subhasis_50 ,
Quite simple with WHEN=GROUP. here is an untested DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11111111111111,A,S,CP,20080520,20081203,CR
11111111111111,B,T,CR,20080521,20081204,DR
11111111111112,A,S,CP,20080520,20081203,CK
11111111111112,B,T,CR,20080521,20081204,DK
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=182,
IFTHEN=(WHEN=INIT,
BUILD=(01,14,
168X,
15,28,
SEQNUM,1,ZD,RESTART=(1,14))),
IFTHEN=(WHEN=GROUP,BEGIN=(211,1,ZD,EQ,1),PUSH=(015:183,28)),
IFTHEN=(WHEN=GROUP,BEGIN=(211,1,ZD,EQ,2),PUSH=(043:183,28)),
IFTHEN=(WHEN=GROUP,BEGIN=(211,1,ZD,EQ,3),PUSH=(071:183,28)),
IFTHEN=(WHEN=GROUP,BEGIN=(211,1,ZD,EQ,4),PUSH=(099:183,28)),
IFTHEN=(WHEN=GROUP,BEGIN=(211,1,ZD,EQ,5),PUSH=(127:183,28)),
IFTHEN=(WHEN=(211,1,ZD,EQ,1),OVERLAY=(043:140X)),
IFTHEN=(WHEN=(211,1,ZD,EQ,2),OVERLAY=(071:112X)),
IFTHEN=(WHEN=(211,1,ZD,EQ,3),OVERLAY=(099:084X)),
IFTHEN=(WHEN=(211,1,ZD,EQ,4),OVERLAY=(127:056X)),
IFTHEN=(WHEN=(211,1,ZD,EQ,5),OVERLAY=(155:028X)),
IFTHEN=(WHEN=(211,1,ZD,EQ,6),OVERLAY=(155:183,28))
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,14,TRAILER3=(1,182))
/*
_________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
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