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

Creating additional seqnum/Literal while sorting.


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

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Wed Oct 21, 2020 9:35 pm
Reply with quote

Hi,
I was able to create the additional seq num which could help me in getting the desired sort order. However again it blocked me to bring the required group of recs on TOP. to do this i was trying put 2nd counter/Some Literal to help but still not getting my O/P.

The steps i done:

I/P file:
Code:


My code to generate output

1 to 21 chars is KEY. And for each key if we have LATE recs that should come on top

If group doesn't have LATE recs that can down based on KEY value.

99693CFU4120621397012  2020-10-19-16.57.36.000000  LATE                000000001  11
20294CWU4520037408003  2020-10-15-21.03.48.119110  RENEWAL      SENT   000000012  21
99693CFU4120521342011  2020-10-13-21.01.43.075070  RENEWAL      SENT   000000888  21
99693CFU4120621397012  2020-10-09-21.01.24.115110  RENEWAL      SENT   000000601  21
20294CWU4520037408003  2020-10-01-17.44.42.632571  COMPLETE            000000021  31
99693CFU4120521342011  2020-10-01-18.15.13.505242  COMPLETE            000000091  31
99693CFU4120621397012  2020-10-02-09.36.17.175946  COMPLETE            000000020  31
99693CFU4120621397013  2020-10-02-09.36.17.175946  COMPLETE            000000020  31
20294CWU4520037408003  2020-10-20-20.42.06.370370  #Exception:                    40
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  41
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  42
20281CWU4520033398003  2020-10-20-20.42.06.370370  #Exception:                    40
20281CWU4520033398003  2020-10-20-20.42.06.370370  -----------------------------  41
20281CWU4520033398003  2020-10-20-20.42.06.370370  Invalid provisioning Data - E  42
20281CWU4520033398003  2020-10-20-20.42.06.370370  -----------------------------  47
99693CFU4120521342011  2020-10-20-20.42.06.370370  #Exception:                    40
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  41
99693CFU4120521342011  2020-10-20-20.42.06.370370  EX009000E (1) INTERNAL ERROR:  42
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  46
20274CWU4520030894006  2020-10-20-20.42.06.370370  #Exception:                    40
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  41
20274CWU4520030894006  2020-10-20-20.42.06.370370  Invalid provisioning Data - E  42
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  47
20275CWU4520040616005  2020-10-20-20.42.06.370370  #Exception:                    40
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  41
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  47
Code:

SORT FIELDS=(1,21,CH,A)                                           
  INREC  IFTHEN=(WHEN=INIT,                                       
                 OVERLAY=(86:SEQNUM,1,ZD,START=0,RESTART=(1,21))),
         IFTHEN=(WHEN=GROUP,BEGIN=(86,1,CH,EQ,C'0'),             
                            PUSH=(90:3,3)),                       
         IFTHEN=(WHEN=INIT,                                       
                 OVERLAY=(86:90,3,ZD,ADD,                         
                            86,1,ZD,EDIT=(TTT))),                 
         IFOUTLEN=200                                             
  OUTFIL REMOVECC,                                               
    SECTIONS=(1,21,                                               
      TRAILER3=(200:X))                                           


But my output file came as like below. I need all LATE records and associated KEY value(1,21) should come on top. I have created some seq number, and that 1st occurance of seq number made as constant on each group to sort. i think here either i need 2nd sequence to sort the LATE group recs on TOP. Not sure. can you advise me on that...?



Code:
20274CWU4520030894006  2020-10-20-20.42.06.370370  #Exception:                    40 274 274
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  41 275 274
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  47 281 274

20275CWU4520040616005  2020-10-20-20.42.06.370370  #Exception:                    40 275 275
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  41 276 275
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  47 282 275

20294CWU4520037408003  2020-10-21-04.19.09.000000  LATE                000000001  11 294 294
20294CWU4520037408003  2020-10-15-21.03.48.119110  RENEWAL      SENT   000000012  21 294 294
20294CWU4520037408003  2020-10-01-17.44.42.632571  COMPLETE            000000021  31 294 294
20294CWU4520037408003  2020-10-20-20.42.06.370370  #Exception:                    40 294 294
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  41 295 294
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  42 296 294

99693CFU4120521342011  2020-10-19-16.47.14.000000  LATE                000000001  11 693 693
99693CFU4120521342011  2020-10-13-21.01.43.075070  RENEWAL      SENT   000000888  21 693 693
99693CFU4120521342011  2020-10-01-18.15.13.505242  COMPLETE            000000091  31 693 693
99693CFU4120521342011  2020-10-20-20.42.06.370370  #Exception:                    40 693 693
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  41 694 693
99693CFU4120521342011  2020-10-20-20.42.06.370370  EX009000E (1) INTERNAL ERROR:  42 695 693
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  46 699 693

99693CFU4120621397013  2020-10-02-09.36.17.175946  COMPLETE            000000020  31 693 693

Back to top
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Wed Oct 21, 2020 9:42 pm
Reply with quote

If i get my ouput like this, may be in next step i can sort it.

adding extra sequence number, but it should be same number for a group when we have LATE recs.
Code:

20274CWU4520030894006  2020-10-20-20.42.06.370370  #Exception:                    40 274 274
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  41 275 274
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  47 281 274

20275CWU4520040616005  2020-10-20-20.42.06.370370  #Exception:                    40 275 275
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  41 276 275
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  47 282 275

20294CWU4520037408003  2020-10-21-04.19.09.000000  LATE                000000001  11 294 294  1
20294CWU4520037408003  2020-10-15-21.03.48.119110  RENEWAL      SENT   000000012  21 294 294  1
20294CWU4520037408003  2020-10-01-17.44.42.632571  COMPLETE            000000021  31 294 294  1
20294CWU4520037408003  2020-10-20-20.42.06.370370  #Exception:                    40 294 294  1
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  41 295 294  1
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  42 296 294  1

99693CFU4120521342011  2020-10-19-16.47.14.000000  LATE                000000001  11 693 693  1
99693CFU4120521342011  2020-10-13-21.01.43.075070  RENEWAL      SENT   000000888  21 693 693  1
99693CFU4120521342011  2020-10-01-18.15.13.505242  COMPLETE            000000091  31 693 693  1
99693CFU4120521342011  2020-10-20-20.42.06.370370  #Exception:                    40 693 693  1
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  41 694 693  1
99693CFU4120521342011  2020-10-20-20.42.06.370370  EX009000E (1) INTERNAL ERROR:  42 695 693  1
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  46 699 693  1

99693CFU4120621397013  2020-10-02-09.36.17.175946  COMPLETE            000000020  31 693 693


when i tried with another condition
IFTHEN=(WHEN=INIT,
OVERLAY=(95:SEQNUM,1,ZD,START=0,RESTART=(1,21))),

it added 2nd seq num, but it generated 1 to 10 numbers sequentailly.
icon_sad.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Wed Oct 21, 2020 10:22 pm
Reply with quote

Would you mind to just show input and desired final output?
Back to top
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 41
Location: pune

PostPosted: Wed Oct 21, 2020 11:12 pm
Reply with quote

Input file
Code:

99693CFU4120621397012  2020-10-19-16.57.36.000000  LATE                000000001  11
20294CWU4520037408003  2020-10-15-21.03.48.119110  RENEWAL      SENT   000000012  21
99693CFU4120521342011  2020-10-13-21.01.43.075070  RENEWAL      SENT   000000888  21
99693CFU4120621397012  2020-10-09-21.01.24.115110  RENEWAL      SENT   000000601  21
20294CWU4520037408003  2020-10-01-17.44.42.632571  COMPLETE            000000021  31
99693CFU4120521342011  2020-10-01-18.15.13.505242  COMPLETE            000000091  31
99693CFU4120621397012  2020-10-02-09.36.17.175946  COMPLETE            000000020  31
99693CFU4120621397013  2020-10-02-09.36.17.175946  COMPLETE            000000020  31
20294CWU4520037408003  2020-10-20-20.42.06.370370  #Exception:                    40
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  41
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  42
20281CWU4520033398003  2020-10-20-20.42.06.370370  #Exception:                    40
20281CWU4520033398003  2020-10-20-20.42.06.370370  -----------------------------  41
20281CWU4520033398003  2020-10-20-20.42.06.370370  Invalid provisioning Data - E  42
20281CWU4520033398003  2020-10-20-20.42.06.370370  -----------------------------  47
99693CFU4120521342011  2020-10-20-20.42.06.370370  #Exception:                    40
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  41
99693CFU4120521342011  2020-10-20-20.42.06.370370  EX009000E (1) INTERNAL ERROR:  42
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  46
20274CWU4520030894006  2020-10-20-20.42.06.370370  #Exception:                    40
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  41
20274CWU4520030894006  2020-10-20-20.42.06.370370  Invalid provisioning Data - E  42
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  47
20275CWU4520040616005  2020-10-20-20.42.06.370370  #Exception:                    40
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  41
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  47

Output file
20294CWU4520037408003  2020-10-21-04.19.09.000000  LATE                000000001  11 
20294CWU4520037408003  2020-10-15-21.03.48.119110  RENEWAL      SENT   000000012  21   
20294CWU4520037408003  2020-10-01-17.44.42.632571  COMPLETE            000000021  31   
20294CWU4520037408003  2020-10-20-20.42.06.370370  #Exception:                    40   
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  41   
20294CWU4520037408003  2020-10-20-20.42.06.370370  -----------------------------  42 

99693CFU4120521342011  2020-10-19-16.47.14.000000  LATE                000000001  11   
99693CFU4120521342011  2020-10-13-21.01.43.075070  RENEWAL      SENT   000000888  21   
99693CFU4120521342011  2020-10-01-18.15.13.505242  COMPLETE            000000091  31   
99693CFU4120521342011  2020-10-20-20.42.06.370370  #Exception:                    40   
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  41
99693CFU4120521342011  2020-10-20-20.42.06.370370  EX009000E (1) INTERNAL ERROR:  42   
99693CFU4120521342011  2020-10-20-20.42.06.370370  -----------------------------  46   

20274CWU4520030894006  2020-10-20-20.42.06.370370  #Exception:                    40
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  41
20274CWU4520030894006  2020-10-20-20.42.06.370370  -----------------------------  47

20275CWU4520040616005  2020-10-20-20.42.06.370370  #Exception:                    40
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  41
20275CWU4520040616005  2020-10-20-20.42.06.370370  -----------------------------  47

99693CFU4120621397013  2020-10-02-09.36.17.175946  COMPLETE            000000020  31
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Fri Oct 23, 2020 1:09 am
Reply with quote

Give that a try:

Code:
//SIMPLE   EXEC PGM=ICEMAN                                       
//F1       DD DISP=SHR,DSN=&SYSUID..TEST <* FB;84                 
//F2       DD DISP=SHR,DSN=&SYSUID..TEST <* FB;84 (same as above)
//SYSOUT   DD SYSOUT=*                                           
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  JOINKEYS F1=F1,FIELDS=(1,21,A)                                 
  JOINKEYS F2=F2,FIELDS=(1,21,A)                                 
  JOIN UNPAIRED                                                   
  REFORMAT FIELDS=(F1:1,84,F2:85,1)                               
  SORT FIELDS=(85,1,BI,D,1,21,CH,A,83,2,CH,A)                     
  OUTFIL FNAMES=(SORTOUT),                                       
    REMOVECC,                                                     
    SECTIONS=(1,21,SKIP=1L),                                     
  BUILD=(1,84)                                                   
  END                                                             
/*                                                               
//JNF1CNTL DD *                                                   
  END                                                             
/*                                                               
//JNF2CNTL DD *                                                   
  INCLUDE COND=(83,2,CH,EQ,C'11',AND,1,80,SS,EQ,C' LATE ')       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(85:C'X'))                     
  END                                                             
/*


When there are more "LATE" records per key, you need to add some more lines of code.
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 COBOL sorting, with input GDG base COBOL Programming 7
No new posts ISRDSLST(3.4) Do not include addition... TSO/ISPF 0
No new posts Repeat n times by substuting SEQNUM i... DFSORT/ICETOOL 2
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Sorting Date Field DFSORT/ICETOOL 4
Search our Forums:

Back to Top