How to put my input record in single quotes?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to put my input record in single quotes?

Postby skankatala » Thu Mar 29, 2012 7:59 pm

I have a list of PS file names in another PS file.

Sample Input file
record1   
record2   
record3   


My output file should be

'record1'
'record2'
'record3'


Note: record lengths are variables.

Record1 has 40 bytes.
Record2 has 42 bytes.
Record3 has 38 bytes.

I need the single quote before first character of the record and after last character of the record.

Please suggest me...
skankatala
 
Posts: 42
Joined: Sun Dec 11, 2011 9:45 am
Location: Hyderabad
Has thanked: 0 time
Been thanked: 0 time

Re: How to put my input record in single quotes?

Postby BillyBoyo » Thu Mar 29, 2012 8:08 pm

Have a look at STRING in the Language Reference. While there, it is always worth looking around, so at least take in UNSTRING and INSPECT at the same time.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to put my input record in single quotes?

Postby Ed Goodman » Fri Mar 30, 2012 6:21 pm

Something to watch out for: Does your data have ANY CHANCE to have single quotes in it already? Maybe an Irish name, or an Arabic name? The wheels will come off your wagon pretty quickly if that can happen.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: How to put my input record in single quotes?

Postby skankatala » Fri Mar 30, 2012 6:28 pm

Ed Goodman wrote:Something to watch out for: Does your data have ANY CHANCE to have single quotes in it already? Maybe an Irish name, or an Arabic name? The wheels will come off your wagon pretty quickly if that can happen.


Nope, my data doesn't contain any quotes or special characters.

Thanks for your help.
skankatala
 
Posts: 42
Joined: Sun Dec 11, 2011 9:45 am
Location: Hyderabad
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post