View previous topic :: View next topic |
Author |
Message |
digitalnirmal Beginner
Joined: 06 Dec 2005 Posts: 21 Topics: 10
|
Posted: Fri Feb 22, 2008 6:33 am Post subject: left padding with zeros |
|
|
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 |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Feb 22, 2008 6:58 am Post subject: |
|
|
9(7) _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
digitalnirmal Beginner
Joined: 06 Dec 2005 Posts: 21 Topics: 10
|
Posted: Fri Feb 22, 2008 7:01 am Post subject: |
|
|
when u print 9(7) usign disply is shows leading zeros - but tthat does not happen when you write to file |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Feb 22, 2008 7:25 am Post subject: |
|
|
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 |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sat Feb 23, 2008 12:35 am Post subject: |
|
|
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 |
|
 |
|
|