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
 

 

How to append leading zeros using SORT

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

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Wed Oct 24, 2012 11:55 pm    Post subject: How to append leading zeros using SORT
Reply with quote

Hi,

My input file :
Code:
1547186   4
1547224   5
1547232   13
1547232  -15
6677002   9
1547356   7


Output Format:
The first fields contains 9 digits and second field contains 10 digits including sign.

Code:

001547186 000000004
001547224 000000005
001547232-000000002
006677002 000000009
001547356 000000007
000179617 000000007
000623598 000000005
000623644 000000005


Is it possible using SYNC sort.
FMT=FB,LRECL =80 for Input and Output File.

i am using SYNC SORT for Z/OS 1.3.1
Please advise!!
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Thu Oct 25, 2012 12:22 am    Post subject:
Reply with quote

Hello,

If you copy the file, you can use an edit mask to get the leading zeros. For the field than may contain a minus sign, you can specify this field as an SFF value and then use an edit mask to append the leading zeros.

If you get stuck, post what you have and where help is needed. Someone should be here.
Back to top
View user's profile Send private message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Thu Oct 25, 2012 12:51 am    Post subject: Reply to: How to append leading zeros using SORT
Reply with quote

Hi,

I have tried with the sort card, first fields is working fine.But,i don't know how to use the SFF format.

My Sort card is given below:
Code:

//SYSIN    DD *                                   
   SORT FIELDS=COPY,                               
   INREC IFTHEN=(WHEN=INIT,                       
         PARSE=(%01=(ENDBEFR=C',',FIXLEN=09),     
                %02=(ENDBEFR=C',',FIXLEN=10)),     
   BUILD=(%01,UFF,M11,LENGTH=09,X,                 
          %02,SFF,EDIT=(STTTTTTTTT),LENGTH=10,X)) 
     OUTFIL  , BUILD=(1,9,10,10)                   
/*                                                 


I am getting Syntax error.
Please advise!!!
Back to top
View user's profile Send private message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Thu Oct 25, 2012 12:54 am    Post subject: Reply to: How to append leading zeros using SORT
Reply with quote

one more condition:

Remove the duplicate and sum the values..

Please help me..
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Oct 25, 2012 1:11 am    Post subject: Reply to: How to append leading zeros using SORT
Reply with quote

You don't need PARSE, as your data is in fixed positions.

8,x,SFF where x is the length of your field will get you the input.

You also seem to want leading zeros on the other number. That you can just pre-pend two zeros to.

You say you want to SUM (which will remove duplicates) but you need SORT, or you file to be pre-sequence and use MERGE. Yet your output is not in sequence.

Do you need the output in its original order, or can it be sorted (on anything)?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Oct 25, 2012 1:19 am    Post subject:
Reply with quote

Hello,

And i did not notice before - why are there more lines of output than input?
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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