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

Detect break in the sequence


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

New User


Joined: 25 Jan 2007
Posts: 42
Location: france

PostPosted: Tue Mar 20, 2018 1:35 pm
Reply with quote

Hi all,

I have the following input file (lrecl=80, recfm=fb)

Code:
SORTIN DD *
234112
234113
234114
235116
235118
235119
237121
238122
238123
/*


I need to detect the break in the sequence in order to produce the output file below (lrecl=80, recfm=fb).

Code:
SORTOUT DD *
234112 235116
235116 235118
235118 237121
237121 238123
/*



I have no idea how to proceed or even if it is possible with a dfsort.

Can I have your opinion and your help ?

Thank you in advance
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Mar 20, 2018 4:01 pm
Reply with quote

see if You can get some ideas here
ibmmainframes.com/viewtopic.php?t=60704&highlight=sequence

but as far as developing and testing

doing it with a cobol/whatever_other_language program
should take only a few minutes

doing it with dfsort a bit more ...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 20, 2018 8:10 pm
Reply with quote

Code:
237121
238122
Is this not a 'break' here? Considering 237 changed to 238 in the sequence number. Or was that a typo?
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 42
Location: france

PostPosted: Tue Mar 20, 2018 9:32 pm
Reply with quote

Big mistake

Code:
SORTOUT DD *
234112 234114
235116 235116
235118 235119
237121 237121
238122 238123
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Mar 20, 2018 11:19 pm
Reply with quote

Like enrico mentioned, a little bit of coding might be a better choice, since this is pretty much straightforward.

I tried a quick DFSORT version and came up with this. Will post back if I can make it any better or if I find any bugs.
Code:
//STEP01  EXEC PGM=SORT                                       
//SYSOUT    DD SYSOUT=*                                       
//SORTOUT   DD SYSOUT=*                                       
//SORTJNF1  DD DISP=SHR,DSN= Input      (FB/80)
//SORTJNF2  DD DISP=SHR,DSN= Same Input (FB/80)
//SYSIN     DD *                                               
 JOINKEYS FILE=F1,FIELDS=(81,8,A),SORTED,NOSEQCK               
 JOINKEYS FILE=F2,FIELDS=(81,8,A),SORTED,NOSEQCK               
 JOIN UNPAIRED,F1                                             
 REFORMAT FIELDS=(F1:1,6,F2:1,6,?)                             
 INREC IFTHEN=(WHEN=(13,1,CH,EQ,C'B'),                         
      OVERLAY=(07:(7,6,ZD,ADD,+1),SUB,1,6,ZD,M11,LENGTH=6))   
 SORT FIELDS=COPY                                             
 OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(7,6,CH,NE,C'000000'),       
          PUSH=(15:1,6))                                       
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(15,6,                     
      TRAILER3=(15,6,X,1,6)),BUILD=(80X)                       
/*                                                             
//JNF1CNTL  DD *                             
 INREC OVERLAY=(81:SEQNUM,8,ZD,START=0)       
//JNF2CNTL  DD *                             
 INREC OVERLAY=(81:SEQNUM,8,ZD)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Mar 21, 2018 12:33 am
Reply with quote

A friend of mine suggested this can be further simplified, So I have an updated version of the above, which needs only one input and does not need the JOIN operation.
Code:
//SYSIN     DD *                                         
 SORT FIELDS=COPY                                       
 OUTREC IFTHEN=(WHEN=INIT,                               
       OVERLAY=(81:SEQNUM,6,ZD,                         
                81:1,6,ZD,SUB,81,6,ZD,M11,LENGTH=6)),   
        IFTHEN=(WHEN=GROUP,KEYBEGIN=(81,6),PUSH=(81:1,6))
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(81,6,               
      TRAILER3=(81,6,X,1,6)),BUILD=(80X)                 
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 42
Location: france

PostPosted: Wed Mar 21, 2018 2:14 pm
Reply with quote

Respect for this work Arun.
I am impressed.

Thank you very much for this solution that solves my problem.
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 program with sequence number ra... COBOL Programming 5
No new posts Find missing sequence for every key DFSORT/ICETOOL 3
No new posts GDG all in sequence order JCL & VSAM 9
No new posts Sequence number generation for multip... DFSORT/ICETOOL 2
No new posts Search file for records that don't fo... SYNCSORT 8
Search our Forums:

Back to Top