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

Splitting one row into multiple Rows by line feed character


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rajan Moorthy
Warnings : 1

New User


Joined: 04 Jun 2007
Posts: 11
Location: Chennai

PostPosted: Mon May 14, 2018 10:58 pm
Reply with quote

Hi All,

Good Morning. We are receiving report file from vendor, the report file contains multiple rows. Line feed if not properly handled and asked me to separate the lines based on the line feed(X'0A').

Input file Length - LRECL - 140.

Sample Input file : have 3 Rows

.. LOCATION: INDIA0 SAMPLE REPORTS .PROG ID: YZ123 .RPTID:
ABC123. SEQUENCE NUMBER .00
0001 GENERIC REPORTS

Expected output: LRECL - 140. reports in 6 Lines based on Value X'0A' which can be identified as . in input file

line1 - Empty
Line2 - LOCATION: INDIA0 SAMPLE REPORTS
Line3 - PROG ID: YZ123
Line4 - RPTID: ABC123
Line5 - SEQUENCE NUMBER
Line 6 - 000001 GENERIC REPORTS

Can you please help me to resolve this issue ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon May 14, 2018 11:14 pm
Reply with quote

Quote:
Can you please help me to resolve this issue ?
This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. So what have you tried so far, what did not work about what you tried (do NOT say "It didn't work" -- give what you expected and what you actually got), and where do you need help?

Are you always going to have 3 rows? What happens if you have more or less than 3 rows? If you can have more than 3 rows, how many rows do you expect at the most? And, by the way, depending upon how it was transferred to the mainframe, ANY non-printing character may be represented by a period, not just X'0A' characters. Will you have non-printing characters other than X'0A'? If so, what do you want to do about them?
Back to top
View user's profile Send private message
Rajan Moorthy
Warnings : 1

New User


Joined: 04 Jun 2007
Posts: 11
Location: Chennai

PostPosted: Tue May 15, 2018 12:22 am
Reply with quote

Hi Robert,

Thanks for your reply. i tried with Resize, Parse options. but i am not getting the expected results. I was asked to write a simple program for this. But I am trying to achieve thru JCL and looking some idea about how to achieve this.

I given just a sample, the report having thousands of records. The dataset is tranferred thru MFT team. Always the non-printing character is .(X'0A').

Thanks,
Rajan M.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 15, 2018 12:29 am
Reply with quote

Quote:
But I am trying to achieve thru JCL and looking some idea about how to achieve this.
It cannot be done through JCL -- period. JCL allocates resources and executes programs, and that is all it does. You could do it with a custom program written in the language of your choice, or you MIGHT be able to do it through a utility such as SORT, but you will NOT be doing it "thru JCL".

I would probably write a program in COBOL or PERL to do this -- because you have to read in the data records, concatenate them together, then split them based on the X'0A' characters. In COBOL it probably would be less than 300 lines of code, total. One other thing to consider -- how long can the records be between X'0A' characters -- 80? 121? 133? 999?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 15, 2018 1:30 am
Reply with quote

Quote:
In COBOL it probably would be less than 300 lines of code, total.
88 lines with reference modification did it without much error checking.
Back to top
View user's profile Send private message
Rajan Moorthy
Warnings : 1

New User


Joined: 04 Jun 2007
Posts: 11
Location: Chennai

PostPosted: Tue May 15, 2018 1:45 am
Reply with quote

Hi Robert,

Thanks for the reply. I already coded in cobol and it works as expected.

PERFORM VARYING WS-INDEX FROM 1 BY 1 UNTIL WS-INDEX > 134
IF INREC(WS-INDEX:1) = X'0A'
WRITE OUTPUT-FILE FROM WS-OUTREC
MOVE SPACES TO WS-OUTREC
MOVE 1 TO WS-OUTDEX
ELSE
MOVE WS-INREC(WS-INDEX:1) TO WS-OUTREC(WS-OUTDEX:1)
ADD 1 TO WS-OUTDEX
END-IF
END-PERFORM

it is my mistake that i did not mention correctly, i am trying to find the solution thru SORT or ICETOOL.

with respect to your question, "how long can the records be between X'0A' characters" - LRECL is 134, i am expecting anywhere in the records. I believe i answered your question.

I would like solve my question thru DFSORT, ICETOOL or ICEMAN. any lead/idea will be great helpful.

Thanks,
Rajan M.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Tue May 15, 2018 2:06 am
Reply with quote

Rajan Moorthy wrote:
Hi Robert,

Thanks for your reply. i tried with Resize, Parse options. but i am not getting the expected results.


Show us the code what have you tried . Complaining 'not getting expected results' doesn't help anyone.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 15, 2018 8:53 pm
Reply with quote

So if you have a solution in COBOL that works already, why are you wasting your (AND OUR) time asking for a SORT solution? Use the COBOL solution you have. Furthermore, your original post did NOT mention you wanted a SORT / ICETOOL solution. Yes, you posted in the DFSORT/ICETOOL forum but that is by no means an indicator that you actually wanted a DFSORT/ICETOOL solution (there are all sorts of mis-posted questions every week).
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Tue May 15, 2018 8:55 pm
Reply with quote

Not much to expect from a person who has Football as
Mainframe skill
Back to top
View user's profile Send private message
Rajan Moorthy
Warnings : 1

New User


Joined: 04 Jun 2007
Posts: 11
Location: Chennai

PostPosted: Wed May 16, 2018 3:09 am
Reply with quote

Thanks Robert. it is my bad or overlooked that i did not mention DFSORT/ICETOOL in title. I will correct myself while posting next time.

Thanks Pandora-Box(Forgive me if i am not using your correct name). I am working on and Off in mainframe. since i tried with multiple options, i did not save the code. But I will post my code what i tried.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top