Page 1 of 1

how can we retain intial values

PostPosted: Sun Nov 23, 2008 8:21 pm
by kiran_q
Hi All,

Actually, I had doudt when we provide intial value to any of variables and Initialize those variable before using in program it gets reset to spaces or zeroes. how actuall can we retain the intial values.

this logic i am trying to implement this in generating C.S.V(comma seperated file) intial all fiels all am seperating with commas by giving intial value (','), however while intializing the group variable before passing the parameter value the commas field is field with spaces, i wanted this field to be reset to commas how can i do that.

Re: how can we retain intial values

PostPosted: Sun Nov 23, 2008 10:51 pm
by dick scherrer
Hello,

If you properly initialized some variables with specific values, the value will remain unless you change it in the code.

From what you posted, it sounds like you "erased" all the values with the "initialize". . . Initialize does not preserve coded values. Here's the link to that part of the cobol manual:
http://publibz.boulder.ibm.com/cgi-bin/ ... r10/6.2.20?

Suggest you also consider something other than a comma for the delimiter - comma is often found as a valid data value. The tab character works quite well (x'05').

Re: how can we retain intial values

PostPosted: Mon Nov 24, 2008 10:52 pm
by kiran_q
HI Dick,

thank you for providing link.

coming to my query, i need to use with same delimiter since i have to generate the CSV o/p file which need to be transmitted to UNIX environment.

so there is no option for me. moreover my o/p file contain around 500 parameters and 6 different type of records.

if i keep on moving commas after each parameters then it would be 3000 lines of move statements only which is advisable.

so can you suggest best solution to handle this.

man my head is really getting scraped by writing this network programs in mainframe.

Re: how can we retain intial values

PostPosted: Tue Nov 25, 2008 3:17 am
by dick scherrer
Hello,

You could take the record definitions you already have with the initial values established and make a copy with a different name. When you begin each iteration, move the copy to the original and all of the initial values will be there. The INITIALIZE would no longer be needed in the code.

You could get what you want done in one move. You might need to do a bit of editing on the "initial value" definitions to prevent duplicate field names, but that will probably be easier than writing hundreds of statements.