Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get the records when sequnce number is reset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Jun 16, 2010 2:50 pm    Post subject: How to get the records when sequnce number is reset
Reply with quote

hi ,
I have some data like in the sample blow , i want the output to display
only those records where the dequence number is reset.
here the last 3 digits are the sequence number , its FB , ReclLen 80 bytes

Input :

AHB N 81 001
AHB N 81 002
AHB N 81 003
AHB N 81 004
AHB P 41 001
AHB P 41 002
AHB P 41 003
AHB P 41 004
AHB P 41 005
AHB P 45 001
AHB P 45 002
HB0 E 45 001
HB0 E 45 002
HB0 E 45 003

Output :
AHB N 81 004
AHB P 41 005
AHB P 45 002
HB0 E 45 003
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jun 16, 2010 3:31 pm    Post subject:
Reply with quote

Hi,

here is a possible way
Code:
//STEP0100 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                         
AHB N 81 001                             
AHB N 81 002                             
AHB N 81 003                             
AHB N 81 004                             
AHB P 41 001                             
AHB P 41 002                             
AHB P 41 003                             
AHB P 41 004                             
AHB P 41 005                             
AHB P 45 001                             
AHB P 45 002                             
HB0 E 45 001                             
HB0 E 45 002                             
HB0 E 45 003   
/*                         
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                     
  SORT FIELDS=COPY                   
  OUTFIL REMOVECC,NODETAIL,         
  SECTIONS=(1,08,TRAILER3=(1,80))   
/*                                   
           


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

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Jun 16, 2010 7:43 pm    Post subject:
Reply with quote

Thank you it worked
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jun 16, 2010 7:48 pm    Post subject:
Reply with quote

Nice one Gerry. Only one comment though
Would it not be better to use
Code:
//SYSIN    DD *                   
  SORT FIELDS=(1,12,CH,A)         
  OUTFIL REMOVECC,NODETAIL,       
  SECTIONS=(1,08,TRAILER3=(1,80))
Which would also cater for the records not already being in sort order.

I was going to suggest using a SELECT statement in ICETOOL but then I would have had to perform a sort beforehand to ensure that the records were in the correct order. Using your method, amended to sort the data, it's only one pass of the data whether the records are correctly sorted or not.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jun 16, 2010 10:55 pm    Post subject:
Reply with quote

Assuming the records are already in the correct order by 1-8, SELECT can do it using COPY like this:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD *
AHB N 81 001
AHB N 81 002
AHB N 81 003
AHB N 81 004
AHB P 41 001
AHB P 41 002
AHB P 41 003
AHB P 41 004
AHB P 41 005
AHB P 45 001
AHB P 45 002
HB0 E 45 001
HB0 E 45 002
HB0 E 45 003
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,8,CH) LAST USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
/*


If the records are NOT in the correct order, then you'd just have to remove OPTION COPY and let SELECT do a SORT.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Jun 17, 2010 11:33 am    Post subject:
Reply with quote

Thanks Frank,

As a rather infrequent user of DFSORT and hence not frequently nose diving into the manuals, I have now learnt that I can use USING with a SELECT. Another one to stick into the archive.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us