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 

Format Numeric fields with leading zeros

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


Joined: 02 Oct 2021
Posts: 17
Topics: 7

PostPosted: Wed Nov 10, 2021 8:28 am    Post subject: Format Numeric fields with leading zeros Reply with quote

Hi All,

I am trying to create a file using DFSORT which will be input to a COBOL Program. There are some numeric fields with leading spaces, which need to be formatted as S9(10)V99. I tried converting as TO=ZD, but it does not work as expected. I have shown the input and the desired output below.

Please help me with this.

Input:
Code:

       0.01


Desired Output:
Code:

00000000000A


Thanks
Prashanth
Back to top
View user's profile Send private message
erasani
Beginner


Joined: 02 Oct 2021
Posts: 17
Topics: 7

PostPosted: Wed Nov 10, 2021 8:46 am    Post subject: Reply with quote

I have tried with the below SORT card. Got the output as 000000000001. However, i need the Output as 00000000000A.

Code:
SORT FIELDS=COPY               
OUTREC FIELDS=(63,12,SFF,TO=ZD)


Input
Code:
       0.01


Output
Code:
000000000001


Desired Output
Code:
00000000000A
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Nov 10, 2021 3:13 pm    Post subject: Reply with quote

erasani,

use TO=ZDC which will give you the desired results.

Code:

OUTREC FIELDS=(63,12,SFF,TO=ZDC)

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
erasani
Beginner


Joined: 02 Oct 2021
Posts: 17
Topics: 7

PostPosted: Thu Nov 11, 2021 6:03 am    Post subject: Reply with quote

Thanks Kolusu for your help. Works perfectly
Back to top
View user's profile Send private message
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