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

Make last column in file space


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat May 03, 2014 12:03 am
Reply with quote

Hi,

I am having a file having variable length records and last byte of all records have one ',' which i want to make it 'Space'

For e.g:
rec 1: AQAAAAAA,Ashhsjk,jndfklsj,
rec 2: ahd,jsjk,djksljf,

The last byte of records are having ',' which i want to blank.
Let me know if its possible by any verb like string, inspect etc. or best possible method
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: Sat May 03, 2014 12:33 am
Reply with quote

It is not possible to do this with a single COBOL statement. However, with multiple COBOL statements it is easy. Use FUNCTION REVERSE to reverse the variable. Use INSPECT TALLYING LEADING SPACES to count the blanks until the first non-blank character. If the first non-blank character is a comma, use reference modification to change it. Use FUNCTION REVERSE to restore the variable.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat May 03, 2014 2:09 am
Reply with quote

If you use RECORD IS VARYING ... DEPENDING ON ... for your file, your depending-on value will indicate the length of the data.

You could then use that value as a subscript, or for the obfuscating reference-modification.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 3
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
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 Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top