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
 

 

Conitous sequence number for two different files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Conitous sequence number for two different files
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Conitous sequence number for two different files
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.

http://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    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Fri May 06, 2011 7:20 pm    Post subject:
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    Post subject:
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    Post subject:
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    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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm


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