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

How to convert CSV file to vertical format


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8796
Location: Welsh Wales

PostPosted: Tue Jan 27, 2009 1:31 pm
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
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: 8796
Location: Welsh Wales

PostPosted: Tue Jan 27, 2009 2:21 pm
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
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: 8796
Location: Welsh Wales

PostPosted: Tue Jan 27, 2009 3:08 pm
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
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: 8796
Location: Welsh Wales

PostPosted: Tue Jan 27, 2009 6:21 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Jan 27, 2009 6:22 pm
Reply with quote

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

DFSORT Developer


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

PostPosted: Tue Jan 27, 2009 11:55 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed Jan 28, 2009 12:06 am
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
Reply with quote

Hi Frank,

i saw a similar kind of code under the topic
Type_Description_Here 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

Moderator Emeritus


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

PostPosted: Wed Jan 28, 2009 10:02 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Convert Service Unit to CPU Seconds All Other Mainframe Topics 1
No new posts Unable to interpret a hex value to De... COBOL Programming 7
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts how to eliminate null indicator value... DB2 7
Search our Forums:

Back to Top