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 

left padding with zeros

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


Joined: 06 Dec 2005
Posts: 21
Topics: 10

PostPosted: Fri Feb 22, 2008 6:33 am    Post subject: left padding with zeros Reply with quote

I have a field 9(7) which can take values like 4/44/444/4444444 etc
I need to write this data in output file as
0000004
0000044
4444444



how do i get the leading zeros?

if i move 9(7) to 9(7)+, then it prints lie this
0000004+
0000044+
4444444+

is there a way to have leading zeros and not the plus sign
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Feb 22, 2008 6:58 am    Post subject: Reply with quote

9(7)
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
digitalnirmal
Beginner


Joined: 06 Dec 2005
Posts: 21
Topics: 10

PostPosted: Fri Feb 22, 2008 7:01 am    Post subject: Reply with quote

when u print 9(7) usign disply is shows leading zeros - but tthat does not happen when you write to file
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Feb 22, 2008 7:25 am    Post subject: Reply with quote

It does put the leading zeros to file - I have just done it. If you are not getting your leading zeroes then you're file record is defined with Zs instead of 9s.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Sat Feb 23, 2008 12:35 am    Post subject: Reply with quote

Or your original 7 byte field is part of a group variable that is being moved to another group variable that contains your 9(7) field. For eg.:
Code:
01 orig-grp.
    05  orig-fld         pic x(7).  This contains bbbbbb4. Nic's Z(7)
                                    will yield the same value.
    .
    .
    other 05 flds
    .
    .
01 your-grp.
    05  your-fld         pic 9(7).  This will contain bbbbbb4 after the move
                                    below, not 0000004.
    .                               
    .
    other 05 flds
    .
    .

move orig-fld to your-fld

_________________
Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
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 -> Application Programming 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