Replacing a string in a dataset name



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

Replacing a string in a dataset name

Postby vinodj » Mon Feb 13, 2012 8:28 pm

Hello,

I have a dataset name like this :

DSN = U60667.<002.XX>.DATA.

I want to replace <002.XX> with Q1 defined like :
01 Q1 PIC X(110).

Q1 can be of varying length. For this I wrote following code :

INSPECT DSN REPLACING ALL '<002.XX>' BY Q1.

But the compiler gave an error that Q1 is of higher length than '<002.XX>' . Could you suggest me something to overcome this.

Regards,
Vinod.
vinodj
 
Posts: 29
Joined: Wed Nov 23, 2011 6:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Replacing a string in a dataset name

Postby Akatsukami » Mon Feb 13, 2012 9:39 pm

Given that a node in a data set name cannot be more than eight characters in length, why did you define Q1 to be PIC X(110)?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post