Joined: 30 Dec 2006 Posts: 4 Location: POLAND/Lodz
Hello,
Is it possible to replace string with :
the same string having all leading zeros (0) removed ?
If string contains only zeros, last one should not be removed.
Eg. :
network ip address :
123.070.001.000 -> 123.70.1.0 .
I've asked about 1 string, because i suppose 123.070.001.000 can be splited into
123
070
001
000.
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
Have you looked at some of the things that DFSort can do? I'm pretty sure that it can suppress the leading zeros in the 4 fields, and I know that it can shift left squeezing out the resulting blanks.
Have you checked the manual?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
oawo,
It's not clear what you want to do. Changing 123.070.001.000 to 123.70.1.0 is different than suppressing leading zeros in one number per record. DFSORT can do both, but in different ways.
Does the field you want to change start in position 1? If not, where does it start?
What is the RECFM and LRECL of your input file?
Please show a good example of your input records and what you expect for the output records.
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
oawo,
Have you looked at the DFSort manual and the Smart DFSORT Tricks manual? I spotted a function that "can extract the delimited fields into %nn parsed fixed fields" and once there I think DFSort can probably give you what you want.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
oawo,
Here's a DFSORT job that will do what you asked for. I assumed field1 has a maximum length of 30 bytes.
You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's PARSE and SQZ functions. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
Joined: 30 Dec 2006 Posts: 4 Location: POLAND/Lodz
Your answers are what what I've been looking for.
Frank's solution shows exactly how to handle this kind of problems.
I've checked William's link - it contains PARSE - also answer to my question.
Thanks for help !
oawo