Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to convert CSV file to vertical format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sudharsan.soundararajan
Warnings : 1

New User


Joined: 15 Oct 2008
Posts: 17
Location: Chennai

PostPosted: Tue Jan 27, 2009 1:18 pm    Post subject: How to convert CSV file to vertical format
Reply with quote

Hi all,

I have an input CSV file.
It looks like
Code:
AAAA,BBBB,CCCC,DDDD
EEEEEE,FF,GGGGGGG,H
II,JJJJJ,KKKKKK,LLLLLLL


where the line " AAAA,BBBB,CCCC,DDDD" header and each field is of Pic X(10)

The oput put file Must be
Code:
 AAAA  EEEEEE    | II
 BBBB  FF        | JJJJJ
 CCCC  GGGGGGG   | KKKKKK
 DDDD  H         | LLLLLLL 


can this be achieved thru JCL..... Please help me out in this
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 27, 2009 1:31 pm    Post subject:
Reply with quote

Quote:
can this be achieved thru JCL..... Please help me out in this

Yes it can be achieved through JCL. Which program would you like the JCL to execute to achieve your results. SAS, REXX, maybe SORT can do this too.
Back to top
View user's profile Send private message
sudharsan.soundararajan
Warnings : 1

New User


Joined: 15 Oct 2008
Posts: 17
Location: Chennai

PostPosted: Tue Jan 27, 2009 2:06 pm    Post subject:
Reply with quote

Hi Expat,

it would be great if it is done using Sort.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 27, 2009 2:21 pm    Post subject:
Reply with quote

And which SORT product is installed at your site, DFSORT or SYNCSORT ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 27, 2009 2:49 pm    Post subject:
Reply with quote

Expat, you are giving expats a bad name.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 27, 2009 3:08 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
Expat, you are giving expats a bad name.

One has to make the effort sometimes icon_lol.gif
Back to top
View user's profile Send private message
sudharsan.soundararajan
Warnings : 1

New User


Joined: 15 Oct 2008
Posts: 17
Location: Chennai

PostPosted: Tue Jan 27, 2009 6:10 pm    Post subject:
Reply with quote

Hi,

can you provide it in both DFSORT and SYNCSORT..

Thanks in advance
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 27, 2009 6:21 pm    Post subject:
Reply with quote

sudharsan.soundararajan wrote:
Hi,
can you provide it in both DFSORT and SYNCSORT..
Thanks in advance

Why, just to save you the effort of finding out which sort product you use.

Asking for code is one thing that gets to me, especially without any admission or evidence of attempt.

What manuals have you looked at so far, What have you tried on your own and what were the results ?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Jan 27, 2009 6:22 pm    Post subject: Reply to: How to convert CSV file to vertical format
Reply with quote

if You had searched the forums with the simple tokens "SORT CSV"
You would have found .....
http://ibmmainframes.com/viewtopic.php?t=29349&highlight=sort+csv
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jan 27, 2009 11:55 pm    Post subject:
Reply with quote

There's more here than meets the eye.

PARSE will get the fields in fixed positions. But the OP wants to go from a horizontal arrangement of the fields to a vertical arrangement of the fields. Note that the fields from the first input record are in the first output column, the fields from the second record are in the second output column and the fields from the third record are in the third output column.

Perhaps responders should make more of an effort to understand the problem before assuming a simple search will give the answer.

Sudharsan.S,

Do you always have only three records or can you have more than three records (what's the maximum number)? What is the RECFM and LRECL of the input file? Do you really need the | (OR) sign before the third output column?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Jan 28, 2009 12:06 am    Post subject: Reply to: How to convert CSV file to vertical format
Reply with quote

Sorry, my bad icon_redface.gif
Back to top
View user's profile Send private message
sudharsan.soundararajan
Warnings : 1

New User


Joined: 15 Oct 2008
Posts: 17
Location: Chennai

PostPosted: Wed Jan 28, 2009 9:48 am    Post subject:
Reply with quote

Hi Frank,

i saw a similar kind of code under the topic
Type_Description_Here http://ibmmainframes.com/viewtopic.php?t=37296

But my problem is the data fields keep on changing according to their length.
For example i have a Name field which may be 5chars or 25 chars.

Quote:
Do you always have only three records or can you have more than three records (what's the maximum number)?

yes i have totally 23 fields

Quote:
What is the RECFM and LRECL of the input file?

LRECL is 250 and RECFM is FB

Quote:
Do you really need the | (OR) sign before the third output column?
yeah i need it inbetween every data record ( inbetween 2nd and 3rd, 3rd and 4th ..... )

Hi Expat,

i am trying with other similar kind of solution provided in the forum.. in my next post i will paste the result which i got, and the problems i am facing.

I have done with my requirement using a program, but i want to know whether it can be done thru a JCL. Sorry if i have made something wrong.

Thanks in Advance
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 28, 2009 10:02 am    Post subject:
Reply with quote

Hello,

Quote:
I have done with my requirement using a program, but i want to know whether it can be done thru a JCL
No, JCL alone cannot do what you want - it can only execute programs.

These might be programs like the one you mention or some utility like the sort, file-aid, easytrieve, etc. Even if you use the jcl to execute some utility instead of your own compiled code, you still have to "program" the utility. And this code should be documented and promoted as though it were an own-code program.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us