View previous topic :: View next topic |
Author |
Message |
deepeshk79 Beginner
Joined: 20 Jun 2003 Posts: 112 Topics: 48 Location: Bangalore
|
Posted: Fri Sep 30, 2005 4:29 am Post subject: Adding zeroes in each record to the end |
|
|
Hi,
I have a requirement like this in SORT.
Input file (lrecl=10) is
I need the o/p(lrecl = 10) to look like
Code: |
-4445.0400
-893.65000
|
ie. i need to add zeroes to each record till the end of lrecl.
Any thoughts on how to achieve this in SORT ....
Thanks,
Deep * * |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Sep 30, 2005 4:48 am Post subject: |
|
|
Deepeshk79,
Try this code.
Code: |
//R010 EXEC PGM=SORT
//SORTIN DD *
-4445.04
-893.65
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
ALTSEQ CODE=(40F0)
OUTREC FIELDS=(1,10,TRAN=ALTSEQ)
/*
|
Let me give you a brief on this. ALTSEQ command in sort is used to swap/convert one EBCDIC sequence to another. EBCDIC '40' refers to Blanks (X'40') and EBCDIC Code 'F0' refers to Numeric Zero (X'F0'). In the above code, I command Sort to convert all Spaces to Zeroes in positions 1 to 10. I specify this in OUTREC statement using TRAN=ALTSEQ.
Support if your LRECL is 20 bytes containing more than 1 fields and if you wish to convert only one field (say first 10 bytes) then change the control card like this.
Code:
Code: |
SORT FIELDS=COPY
ALTSEQ CODE=(40F0)
OUTREC FIELDS=(1,10,TRAN=ALTSEQ,11,10)
|
Here TRAN=ALTSEQ is not specified for positions 11-20.
Hope this helps,
Try and let us know if you have any questions,
Thanks,
Phantom |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Sep 30, 2005 4:50 am Post subject: |
|
|
You need to have DFSORT, or Syncsort v 1.0 & above (latest v 1.2), for this code to work.
Thanks,
Phantom |
|
Back to top |
|
 |
deepeshk79 Beginner
Joined: 20 Jun 2003 Posts: 112 Topics: 48 Location: Bangalore
|
Posted: Fri Sep 30, 2005 8:47 am Post subject: |
|
|
Hi Kolusu,
Thanks for your prompt reply.
when i tried ur solution i got the following error (RC 16)
Quote: |
********************** TOP OF DATA ****************
1 SYNCSORT 3.7ER TPF4
SYSIN :
SORT FIELDS=COPY
ALTSEQ CODE=(40F0)
OUTREC FIELDS=(1,10,TRAN=ALTSEQ,80:X)
*
WER268A OUTREC STATEMENT : SYNTAX ERROR
******************************** BOTTOM OF DATA ********************************
|
Is it the Syncsort version problem ??
Anyhow i have solved my problem by applying another logic, in which i define have many outfil definitions and i check for spaces and then insert C'0' in the end.
Regards,
Deep * * |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Sep 30, 2005 9:09 am Post subject: |
|
|
Quote: |
Hi Kolusu,
Thanks for your prompt reply.
|
deepeshk79,
Please give credit to the right person. Spend sometime to read as to who answered your question. The only incentive people get answering questions in here is a mere "thank you" . Even though I answer most of the questions, there are many people who post solutions in here . I did NOT answer your answer , phantom did.
As phantom already mentioned you need syncsort for z/os for the solution to work. The other way of solving it using the change command which you already have done.
Thanks
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
deepeshk79 Beginner
Joined: 20 Jun 2003 Posts: 112 Topics: 48 Location: Bangalore
|
Posted: Fri Sep 30, 2005 9:35 am Post subject: |
|
|
Sorry for the confusion !!!!!
Thanks Phantom  |
|
Back to top |
|
 |
|
|