IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Split File into multiple records.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Apr 09, 2014 1:54 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Apr 09, 2014 2:21 pm
Reply with quote

Can the input be like

Code:
A123465/B123/C12346567890/
D1234567890123456/E1
23
4
5
6
7
8
9
0
/
/
/
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Apr 09, 2014 2:39 pm
Reply with quote

Hi,

No. The input will be continuous until 80 byte and then go to next line.

Thanks
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Apr 09, 2014 5:08 pm
Reply with quote

1.What is the length between two '/'?
2.Can there be space in value which between two '/'

like

Code:
/pandora box/

3. How many '/' will be present in a single record?
4.Will a value always end with '/'?
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Apr 09, 2014 5:36 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Apr 09, 2014 6:17 pm
Reply with quote

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
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Wed Apr 09, 2014 7:37 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Apr 09, 2014 7:40 pm
Reply with quote

What is the length of the output file?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 10, 2014 12:09 am
Reply with quote

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
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Atlanta, (USA)

PostPosted: Thu Apr 10, 2014 10:36 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 10, 2014 10:51 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top