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 truncate spaces in a CSV PS file using JCL/COBOL

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

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Mar 28, 2011 8:24 pm    Post subject: How to truncate spaces in a CSV PS file using JCL/COBOL
Reply with quote

Hello team,

I have a CSV file in which certain fields are populated as SPACES.
The seperator here is ';'----> semicolon

Name;Age;Address
John;25;Chicago
Mike;27;Denver
Abby;18;Ohio

In this file I populate the field values using an external DB2 call.
However sometimes my datbase contains spaces for a lot of fields.
Hence, the resultant file looks like this:

Name;Age;Place;.........
John; ;Chicago;........
;27;Denver;.......
Abby;18; ;........

Is there any way to truncate the unnecessary spaces in betwen the seperator ';' and generate the file as follows:

Name;Age;Place;.........
John;;Chicago;........
;27;Denver;.......
Abby;18;;........

Kindly help.
Back to top
View user's profile Send private message

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1017
Location: Oostende, Belgium

PostPosted: Mon Mar 28, 2011 8:29 pm    Post subject:
Reply with quote

DB2 cannot directly generate CSV files, so why don't you do it in the program that actually retrieves the data from DB2 and writes out the CSV file?

Or am I too stupid to understand such a trivial problem?
Back to top
View user's profile Send private message
superman

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Mar 28, 2011 8:41 pm    Post subject:
Reply with quote

Yes I am using a COBOL program for this.It fetches the values from DB2 table then writes it into a file.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1754
Location: Bloomington, IL

PostPosted: Mon Mar 28, 2011 8:47 pm    Post subject:
Reply with quote

So, then, as Mr. Prins suggests you will want to modify that program, won't you?
Back to top
View user's profile Send private message
superman

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Mar 28, 2011 8:55 pm    Post subject:
Reply with quote

Yes I know I can modify the cobol program use INSPECT clause etc fro truncating the spaces etc. but can this be doen with SORT /utility?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1754
Location: Bloomington, IL

PostPosted: Mon Mar 28, 2011 9:58 pm    Post subject:
Reply with quote

Ah, so you deliberately misstated the requirement in your thread title. Do you have any notion of what utilities are available at your site?
Back to top
View user's profile Send private message
superman

New User


Joined: 28 Mar 2011
Posts: 12
Location: india

PostPosted: Mon Mar 28, 2011 10:16 pm    Post subject: Reply to: How to truncate spaces in a CSV PS file using JCL/
Reply with quote

We tried using the following:

OPTION COPY
INREC OVERLAY=(1:1,4502,SQZ=(SHIFT=LEFT,MID=C' '),
1:1,4502,TRAN=LTOU)

However we don't want to loose the any spaces between the data(JOHN**MILLER must remain as it is and not become JOHN*MILLER) i.e we just need to truncate spaces between seperators(;) for our csv file.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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