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

How to append leading zeros using SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Thu Oct 25, 2012 12:22 am
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 25, 2012 1:11 am
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

Moderator Emeritus


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

PostPosted: Thu Oct 25, 2012 1:19 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top