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

Removing leading zeroes from sequence numbers


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

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Thu Sep 15, 2011 5:38 pm
Reply with quote

I am currently attaching sequence numbers to all the records in the file using the sort card

Code:
SORT FIELDS=COPY                   
OUTREC OVERLAY=(1:1,3,6:SEQNUM,5,ZD)


Its getting displayed as

Code:

MEMBER  SEQ NUMBER
ABC                  00001
DEF                  00002
ABD                  00003
.                          .
.              .
.              .
.              .
ZZZ                  09999


However I do not want to have the leading zeroes in the sequence numbers. How should the card be modified so that it will appear as below

Code:

MEMBER  SEQ NUMBER
ABC                         1
DEF                         2
ABC                         3
.                               .
.      .
.      .
.      .
ZZZ                    9999


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

Senior Member


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

PostPosted: Thu Sep 15, 2011 9:57 pm
Reply with quote

seahawk789,

Use FS format for sequence number which will suppress the leading zeroes.

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD *                   
ABC                               
DEF                               
ABD                               
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD *                   
  SORT FIELDS=COPY                 
  INREC OVERLAY=(6:SEQNUM,5,FS)   
/*


will produce
Code:

ABC      1
DEF      2
ABD      3
Back to top
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Fri Sep 16, 2011 11:34 am
Reply with quote

Thanks Skolusu.. u saved my day!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 16, 2011 7:14 pm
Reply with quote

Hello,

Just curious - why does it matter to have the leading zeros removed?

How is "number" to be used?

d
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Sep 16, 2011 8:02 pm
Reply with quote

Quote:
Just curious - why does it matter to have the leading zeros removed?


Dick after all this time icon_eek.gif
because that' s the requirement
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 16, 2011 8:34 pm
Reply with quote

Hi Enrico,

Yup, but often there is some reason for a "requirement". . . icon_wink.gif

I continue to wonder where we get the "managers" who generate such "requirements" icon_confused.gif

And while we're still at it - i suspect the number with the leading zeros would be more usable / portable . . . Especially if it is to be used as input to another mainframe process. . .

d
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
Search our Forums:

Back to Top