MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding zeroes in each record to the end

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Fri Sep 30, 2005 4:29 am    Post subject: Adding zeroes in each record to the end Reply with quote

Hi,

I have a requirement like this in SORT.

Input file (lrecl=10) is

Code:

-4445.04
-893.65


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
View user's profile Send private message AIM Address
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Sep 30, 2005 4:48 am    Post subject: Reply with quote

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
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Sep 30, 2005 4:50 am    Post subject: Reply with quote

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
View user's profile Send private message
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Fri Sep 30, 2005 8:47 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Sep 30, 2005 9:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
deepeshk79
Beginner


Joined: 20 Jun 2003
Posts: 112
Topics: 48
Location: Bangalore

PostPosted: Fri Sep 30, 2005 9:35 am    Post subject: Reply with quote

Sorry for the confusion !!!!! Smile

Thanks Phantom Smile
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group