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
 

 

Append records with sequence number - Syncsort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Aug 04, 2009 8:52 pm    Post subject: Append records with sequence number - Syncsort.
Reply with quote

Hi, We are using SYNCSORT v1.2 and below given is my input file (LRECL=80, RECFM=FB).

Input:
Code:

----+----1----+----2----+----3
ABC123EXTR       
ABC1233095SDSC2008
ABC1233095SDSC2009
DEF123EXTR       
DEF1233095SDSC2008
GHI123EXTR       
GHI1233095SDSC2009
JKL123EXTR       
JKL1233095SDSC2008
MNO123EXTR       
MNO1233095SDSC2009
ABC123EXTR       
ABC1233095SDSC2008
ABC1233095SDSC2009


I need the output to be in below format:
Code:

----+----1----+----2----+----3
ABC123EXTR         00000001
ABC1233095SDSC2008 00000001
ABC1233095SDSC2009 00000001
ABC123EXTR         00000006
ABC1233095SDSC2008 00000006
ABC1233095SDSC2009 00000006
DEF123EXTR         00000002
DEF1233095SDSC2008 00000002
GHI123EXTR         00000003
GHI1233095SDSC2009 00000003
JKL123EXTR         00000004
JKL1233095SDSC2008 00000004
MNO123EXTR         00000005
MNO1233095SDSC2009 00000005


I have tried the below sysin cards but getting wrong results:

SYSIN card-1:
Code:

//SYSIN    DD *                               
  INREC OVERLAY=(20:SEQNUM,8,ZD,RESTART=(1,6))
  SORT FIELDS=(1,6,CH,A,20,8,CH,A)           
/*                                           


SYSIN card-2:
Code:

//SYSIN    DD *                               
  INREC OVERLAY=(20:SEQNUM,8,ZD)
  SORT FIELDS=(1,6,CH,A,20,8,CH,A)           
/*                                           


Unwanted Result-1:
Code:

ABC123EXTR         00000001
ABC123EXTR         00000001
ABC1233095SDSC2008 00000002
ABC1233095SDSC2008 00000002
ABC1233095SDSC2009 00000003
ABC1233095SDSC2009 00000003
DEF123EXTR         00000001
DEF1233095SDSC2008 00000002
GHI123EXTR         00000001
GHI1233095SDSC2009 00000002
JKL123EXTR         00000001
JKL1233095SDSC2008 00000002
MNO123EXTR         00000001
MNO1233095SDSC2009 00000002


Unwanted Result-2:
Code:

ABC123EXTR         00000001
ABC1233095SDSC2008 00000002
ABC1233095SDSC2009 00000003
ABC123EXTR         00000012
ABC1233095SDSC2008 00000013
ABC1233095SDSC2009 00000014
DEF123EXTR         00000004
DEF1233095SDSC2008 00000005
GHI123EXTR         00000006
GHI1233095SDSC2009 00000007
JKL123EXTR         00000008
JKL1233095SDSC2008 00000009
MNO123EXTR         00000010
MNO1233095SDSC2009 00000011


Please help.

Thanks.
Back to top
View user's profile Send private message

bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Wed Aug 05, 2009 12:37 pm    Post subject:
Reply with quote

Please explain on what basis u need the sequence number in output file.From the examples i cant understand that...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Aug 05, 2009 12:53 pm    Post subject:
Reply with quote

Hi,

from what I can see the input needs to be sequenced as such
based on the first 6 bytes.
Code:
ABC123EXTR         00000001   
ABC1233095SDSC2008 00000001   
ABC1233095SDSC2009 00000001   
DEF123EXTR         00000002   
DEF1233095SDSC2008 00000002   
GHI123EXTR         00000003   
GHI1233095SDSC2009 00000003   
JKL123EXTR         00000004   
JKL1233095SDSC2008 00000004   
MNO123EXTR         00000005   
MNO1233095SDSC2009 00000005   
ABC123EXTR         00000006   
ABC1233095SDSC2008 00000006   
ABC1233095SDSC2009 00000006   


Once that's achieved, the records need to be sorted as such
Code:
SORT FIELDS=(1,6,BI,A,20,8,BI,A) 



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

Moderator


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

PostPosted: Wed Aug 05, 2009 2:04 pm    Post subject:
Reply with quote

Ramsri,

The below Syncsort job would do what you asked for.
Code:
//STEP1  EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DSN= Input  file (FB/80)
//SORTOUT  DD DSN= Output file (FB/80)
//SYSIN    DD *                                                     
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(20:SEQNUM,8,ZD)),                 
       IFTHEN=(WHEN=(11,1,CH,EQ,C' '),                             
       OVERLAY=(20:SEQNUM,8,ZD)),                                   
       IFTHEN=(WHEN=NONE,                                           
       OVERLAY=(81:SEQNUM,8,ZD,20:20,8,ZD,SUB,81,8,ZD,M11,LENGTH=8))
 SORT FIELDS=(1,6,CH,A),EQUALS                                     
 OUTREC BUILD=(1,80)                                               
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Aug 05, 2009 3:06 pm    Post subject: Reply to: Append records with sequence number - Syncsort.
Reply with quote

Hi, Arun.

I will try this solution and come back.

Thanks.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Aug 06, 2009 5:07 pm    Post subject: Reply to: Append records with sequence number - Syncsort.
Reply with quote

Thank you Arun......It is working as expected icon_biggrin.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Aug 07, 2009 11:10 am    Post subject:
Reply with quote

You're welcome icon_smile.gif
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 -> JCL & VSAM 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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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