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
 

 

Require help with sequence number

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

New User


Joined: 15 May 2006
Posts: 90

PostPosted: Tue Apr 17, 2012 9:29 am    Post subject: Require help with sequence number
Reply with quote

Hi,

Actually, my requirement is to put sequence number at a particular position based on record type. It is a variable lenght file.

TYPE --- Position for Sequnce number (8)
--------- -----------------------------
1644 --- 107
1240 --- 689
1540 --- 151
1740 --- 179


I tried doing it (only for 2 rec types) and below is my attempt:

Code:
//SYSIN DD *                                                           
  RECORD TYPE=V                                                         
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=(56,4,CH,EQ,C'1240'),OVERLAY=(693:SEQNUM,8,ZD)),   
        IFTHEN=(WHEN=(56,4,CH,EQ,C'1644'),OVERLAY=(111:SEQNUM,8,ZD))   
// 




But the issue with it is that the sequence number resets for next record type.

For eg. It is coming like like


1240 - 000001
1240 - 000002
1240 - 000003
1644 - xxxxxxx000001
1644 - xxxxxxx000002
1644 - xxxxxxx000003
1644 - xxxxxxx000004


But I require something like:

1240 - 000001
1240 - 000002
1240 - 000003
1644 - xxxxxxx000004
1644 - xxxxxxx000005
1644 - xxxxxxx000006
1644 - xxxxxxx000007

Any kind of help will be really appreciated.

Regards,
Mohit
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Tue Apr 17, 2012 11:52 am    Post subject: Reply to: Require help with sequence number
Reply with quote

Every time you use SEQNUM it is a different one.

So, if you have SEQNUM on WHEN=INIT, inserted at the beginning of your records (because your records are variable) (unless there is an "unused" portion of the fixed part of the record you could re-use temporarily) and then with the WHEN=(condition) copy the added field to where you want it for that particular record-type.

After each record is processed, you have to "clean up" the now surplus SEQNUM, with BUILD,
Back to top
View user's profile Send private message
nagaraj_bez

New User


Joined: 09 Jun 2005
Posts: 10

PostPosted: Tue Apr 17, 2012 11:56 am    Post subject:
Reply with quote

Hi Mohitsaini,

Try the following steps.
Step-1: Number all records
Step-2: using overlay as u have tried, write the output record based on conditions.

Example:
input :

1234561240
1234561644
expected output :
add seq number in 7th position( before 1240) for 1240, 11th position(after 1644) for 1644 condition

123456000000011240
123456164400000002

Step1 o/p : (added seq number at starting 1-8 position)
000000011234561240
000000021234561644

Step2 o/p: based on condition
123456000000011240
123456164400000002
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Apr 17, 2012 9:49 pm    Post subject: Reply to: Require help with sequence number
Reply with quote

mohitsaini,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=Your Input VB File,DISP=SHR                             
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,5)),               
  IFTHEN=(WHEN=(64,4,SS,EQ,C'1240,1540,1644,1740'),         
  OVERLAY=(5:SEQNUM,8,ZD),HIT=NEXT),                       
  IFTHEN=(WHEN=(64,4,CH,EQ,C'1240'),OVERLAY=(701:5,8)),     
  IFTHEN=(WHEN=(64,4,CH,EQ,C'1540'),OVERLAY=(163:5,8)),     
  IFTHEN=(WHEN=(64,4,CH,EQ,C'1644'),OVERLAY=(119:5,8)),     
  IFTHEN=(WHEN=(64,4,CH,EQ,C'1740'),OVERLAY=(191:5,8))     
                                                           
  OUTREC BUILD=(1,4,13)                                     
//*
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 90

PostPosted: Tue Apr 24, 2012 3:20 pm    Post subject: Reply to: Require help with sequence number
Reply with quote

Thanks it is working . ..
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 Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
No new posts Require help in DB2 Query Shruti Takkar DB2 3 Wed Aug 03, 2016 10:57 pm
No new posts GDG vsersion number change Raghu navaikulam JCL & VSAM 5 Fri May 27, 2016 4:49 pm
No new posts CPU time Vs Number of records Nileshkul JCL & VSAM 5 Mon May 09, 2016 4:05 pm


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