View previous topic :: View next topic
|
Author |
Message |
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
I have an operation to be perfomed on a file of 80 bytes length. This file has continuous data. Need to split the data in a file of 150 length based on a character "/".
For example my file looks like
Code: |
A123465/B123/C12346567890/
D1234567890123456/E123456
7890/
|
The output of the above should be
Code: |
A123456
B123
C1234567890
D1234567890123456
E1234567890
|
Please let me know if we can do this by sort.
Thanks |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Can the input be like
Code: |
A123465/B123/C12346567890/
D1234567890123456/E1
23
4
5
6
7
8
9
0
/
/
/ |
|
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
No. The input will be continuous until 80 byte and then go to next line.
Thanks |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
1.What is the length between two '/'?
2.Can there be space in value which between two '/'
like
3. How many '/' will be present in a single record?
4.Will a value always end with '/'? |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
The length between two "/" can vary.
There cannot be a space between two "/", Also there can never be a scenario like "//".
Thanks. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Can you answer this
1.How many '/' will be present in a single record?
2.Will a value always end with '/'?
3.Will value exceed the length of 80? |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
1.How many '/' will be present in a single record?
--> There can be None to more than one on each record.
2.Will a value always end with '/'?
--> Yes
3.Will value exceed the length of 80?
--> Yes, it can exceed length of 80 |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What is the length of the output file? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
muffirulz wrote: |
I have an operation to be perfomed on a file of 80 bytes length. This file has continuous data. Need to split the data in a file of 150 length based on a character "/". |
So which one is true ? is your input file 150 bytes in length or 80 bytes in length? What is the RECFM of the INPUT file?
muffirulz wrote: |
1.How many '/' will be present in a single record?
--> There can be None to more than one on each record.
|
From your sample input it is evident that you want combine 2 records that are broken across records.
For example assuming your LRECl=80 and you have a string without "/" all the way upto 80 bytes. Now do you need to combine this record with the next record till it finds the "/" If you do want that done, aren't you going beyond the record length for each string?
muffirulz wrote: |
The input will be continuous until 80 byte and then go to next line. |
what is the maximum number of records that would not have a "/" ? what if you have 409+ records like that, how are you planning to merge them altogether into a single record as merging them as a single record will exceed the Maximum allowable record length of z/OS |
|
Back to top |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
Hi,
The Input File is of 80 bytes and the output file will be of 150 bytes. The recfm is FB.
Yes. If a string goes to the second line in between two delimiters '/', then I need to combine both the strings and put it in the file of 150 bytes. There wont be a scenario when I will have the toptal length of the string between two delimiters '/' to be more than 120 bytes. Therefore it wont be more than 2 - 3 lines of 80 bytes.
Hope the above explanation helps.
Thanks. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
muffirulz,
It can be done in DFSORT, however it would require 2 passes of data.
1. Resize with parse
2. Copy for merging the broken strings together.
On the other hand a simple COBOL program with PERFORM Varying will give you the results with a single pass of data quite easily. So I suggest that you write a program to get the results rather than relying on DFSORT with 2 passes of data. |
|
Back to top |
|
|
|