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

Conitous sequence number for two different files


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

New User


Joined: 02 Dec 2006
Posts: 33
Location: chennai

PostPosted: Thu May 05, 2011 11:31 pm
Reply with quote

Hi All,

I have a requirement tp assign sequence no to two different files with same DCB parameter: LRECL=4900, RECFM=FB


Need to assign continous sequence number to these files at different positions

File1: LRECL=4900, RECFM=FB with record type as 'P'(position 1).
Assign 12 byte sequence number at positon 2406

File2: LRECL=4900, RECFM=FB with record type as 'B' (position 1).
Assign 12 byte sequence number at position 3406. The sequence number assigned to this file should start from the next available sequence number from file1.


Desired output
-----------------
2406 pos 3406 pos
Pxyz............000000000001
Pjkjkj..........000000000002
Bjkjkj....................................000000000003
Babcd....................................000000000004

Please advise.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 06, 2011 1:11 am
Reply with quote

Kitchu84,

Concatenate both input files to sortin and use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your input file1,DISP=SHR
//         DD DSN=Your input file2,DISP=SHR
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFOUTLEN=4900,IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B'),       
  OVERLAY=(4901:SEQNUM,12,ZD),HIT=NEXT),                     
  IFTHEN=(WHEN=(1,1,CH,EQ,C'P'),OVERLAY=(2406:4901,12)),     
  IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(3406:4901,12))     
//*
Back to top
View user's profile Send private message
kitchu84

New User


Joined: 02 Dec 2006
Posts: 33
Location: chennai

PostPosted: Fri May 06, 2011 1:57 am
Reply with quote

Thanks you soooooooooooooooooo much Skolusu ... its working perfectly ... I never knew about this capability ...


icon_smile.gif icon_smile.gificon_smile.gif ...

thanks again!
Back to top
View user's profile Send private message
kitchu84

New User


Joined: 02 Dec 2006
Posts: 33
Location: chennai

PostPosted: Fri May 06, 2011 2:09 am
Reply with quote

hello Skolusu,

I also wanted to know

1. what does this mean:

"IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B')" - Is there any significance of 'SS' here

2. Also, if in the sequence number i need to have numbering like N00000000001
N00000000002
N00000000003
....................
....................
N000000000090
(sequence is 12 bytes and the first letter is always N).

Please advise.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 06, 2011 2:51 am
Reply with quote

Quote:
.Is there any significance of 'SS' here


kitchu84,

Substring(SS) format is used to check multiple values or find a value anywhere within a field value. Check this link for a better understanding of Substring Comparison.

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca50/3.7.4

Quote:
Also, if in the sequence number i need to have numbering like N00000000001. (sequence is 12 bytes and the first letter is always N)


That is quite simple. All you are doing is making the sequm a 11 byte field with N in front. If that is the case just change this statement in my original post

Code:

OVERLAY=(4901:SEQNUM,12,ZD),HIT=NEXT),   


to
Code:

OVERLAY=(4901:C'N',SEQNUM,11,ZD),HIT=NEXT),   
Back to top
View user's profile Send private message
kitchu84

New User


Joined: 02 Dec 2006
Posts: 33
Location: chennai

PostPosted: Fri May 06, 2011 3:04 am
Reply with quote

Thanks again!!! You rock! icon_smile.gif icon_cool.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 06, 2011 3:18 pm
Reply with quote

Hi Kolusu,
I am just thinking.. Why you have used..
Code:

IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B'), 


Rather it could be just...

Code:
IFTHEN=(WHEN=INIT,
.. .and hence no need of hit=next also... icon_rolleyes.gif
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri May 06, 2011 7:20 pm
Reply with quote

What if there are other record types like X,Y,Z?

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri May 06, 2011 7:34 pm
Reply with quote

sqlcode1 wrote:
What if there are other record types like X,Y,Z?

Thanks,

OP says
Quote:

File1: LRECL=4900, RECFM=FB with record type as 'P'(position 1).
File2: LRECL=4900, RECFM=FB with record type as 'B' (position 1).
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 06, 2011 9:25 pm
Reply with quote

Escapa,

I assumed that there can be other record types other than 'P' and 'B'. If OP is sure of the record types then we can use When=init. The provided solutions takes care even when they have different record types.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top