MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Resize field in COBOL?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Disco_Stu
Beginner


Joined: 04 Feb 2003
Posts: 19
Topics: 7

PostPosted: Thu Aug 25, 2005 12:39 pm    Post subject: Resize field in COBOL? Reply with quote

I am passing a character string to a cobol program. A query is then going to be done on this string.

The max size is 40 characters. I need to size of the field used in the query to match the size of the string that is passed. For example, if the string being passed was "HELLO", I woud need that moved to a field defined as PIC x(5). Otherwise the trailing spaces will screw up my query.

The only option i've come up with is the create 40 working storage fields with lengths of 1-40. Then interrogate the passed field size and move to appropriate working storage field. That seems pretty ugly.

Anyone know of a better way? Can a field length be changed dynamically?

Thanks.
Back to top
View user's profile Send private message
Disco_Stu
Beginner


Joined: 04 Feb 2003
Posts: 19
Topics: 7

PostPosted: Thu Aug 25, 2005 12:43 pm    Post subject: Reply with quote

Think i just answered my own post. I can use SUBSTR(fieldname,start,length) in my SQL to point to the portion of the string that i want to use.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group