Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message 203 1

Status
Not open for further replies.

carolly

Programmer
Aug 2, 2001
27
AU
I keep coming up with an error message 203 in my sub program. I am sure that I have called the sub program correctly but this message says that I have not initialised the item. I have initialised the item in the main program to zero and again in the subprogram.

This is the code that I have used:

from the main program in working storage:

01 w-invalid-records pic 9(02).
01 w-valid-records pic 9(02).

move zeros to w-invalid-records
move zeros to w-valid-records

call subprogram using w-invalid-records,w-valid-records

in the subprogram linkage section:

c-valid-records pic 9(02).
c-invalid-records pic 9(02).

procedure division using c-invalid-records,c-valid-records.

move zeros to c-valid-records
move zeros to c-invalid-records

I get the error at runtime when I am adding or moving data into c-valid-records etc

 
Hi,

Your code looks ok.

Perhaps it is the runtime-environment of your called module that gives a problem. Check the way you linked your called module.

Regards,

Crox
 
I would be interested in knowing what COBOL Compiler and Runtime you are using.

Try changing the following statement in the sub-program from ...

procedure division using c-invalid-records,c-valid-records.
to...
procedure division using c-valid-records,c-invalid-records.

Next, try changing the following from...

move zeroes to c-valid-records
to...
move all zeroes to c-valid-records
and...
move zeroes to c-invalid-records
to...
move all zeroes to c-invalid-records

This is just a guess... good luck Saginaw
Saginaw@simotime.com
 
Hi Caroll,

I noticed you had no 01 levels associated w/the LS data names. Probably a typo, else you couldn't compile sub.

I also noticed the 2 flds are reversed in the sub LS and the USING. Shouldn't hurt, but I'd change them JIC. Whenever I run into this kind of Twilight Zone problem I get superstitious.

You didn't say what the sub does or what it's expecting from the caller. Sounds like the sub is expecting nothing from the caller except a place to put the results. Are any files used by the sub. Have they been defined to the run unit? Etc.

This harks back to Stephen Spiro's complaint (and mine) that the problem s/b defined both technically and fron the "business" perspective, i.e., not only what it does but what the user wants it to do. The user usually sees the prob differently than the tech person.

Regards, Jack.
 
I was incorrect in my previous note... do not change the following from...

procedure division using c-invalid-records,c-valid-records.
to...
procedure division using c-valid-records,c-invalid-records.

This will result in switching the contents of valid and invalid records. Simply change the Linkage Section items from ...

c-valid-records pic 9(2).
c-invalid-records pic 9(2).
to...
c-invalid-records pic 9(2).
c-valid-records pic 9(2).

Sorry...




Saginaw
Saginaw@simotime.com
 
I noticed the following. I don't know if it makes a difference or not, but it might.

In working-storage, you have:

01 w-invalid-records pic 9(02).
01 w-valid-records pic 9(02).


And then you initialize these 2 fields and call the subprogram:

call subprogram using w-invalid-records,w-valid-records


But then in your subprogram's linkage section, you have:

c-valid-records pic 9(02).
c-invalid-records pic 9(02).


And then in procedure, you have:

procedure division using c-invalid-records,c-valid-records.


So you are calling a subprogram assigning storage to W-VALID RECORDS and W-INVALID-RECORDS. But your subprogram's linkage section designates 2 fields called C-VALID RECORDS and C-INVALID-RECORDS, as does your procedure division. There seems to be a mismatch here because W-VALID RECORDS is not the same field as C-VALID RECORDS.

Please clear me up. Doesn't the calling program have to use and designate the same fields as those in the called program's linkage section? Don't they have to have the same name?

This way, when you reference the fields in your calling program, and you initialize them, they will already be initialized in your subprogram and ready to go.

Try changing the names of the linkage division fields in your subprogram to:

01 w-invalid-records pic 9(02).
01 w-valid-records pic 9(02).


And change your procedure division to:

procedure division using w-invalid-records,w-valid-records.


Hope this helps, Nina Too
 
Hi Nina,

No the calling/caller don't have to use the same names; just the same length. Actually they don't NECESSARILY hve to be that either, so long as you know what you want to accomplish and how the data passing aspects of subpgms work.

The linkage sect of the called pgm acts as an name overlay similar to a dsect in BAL. It references the same place in memory that the W- fields of the calling pgm do. Therefore you can call them any valid dataname. You can change the pic in the LS so long as you know how the pic relates to the data, e.g.:

If the caller defined the passed data as pic xx, the subpgm could define it as pic 99 if the field was required for a math operation. However, it couldn't be defined in the subpgm as pic 99 comp-3 (without dire consequences) unless something like x'023C'
was moved to the field by the caller before the subpgm call.

I share your concern about the order of the fields in ws/ls/using.

Regards, Jack.
 
Jack, thanks, I didn't know. Everywhere I've worked, we've always used the same field names, usually using copybooks in both the calling and called program. Makes it a lot less confusing.

Okay, though, another question. If Carolly initializes the fields in the calling program, then issues the call, aren't these same (or corresponding) fields already initialized when you get to the subprogram? So you shouldn't have to initialize them again?

Nina Too
 
You're right on there, Nina. You see a lot of that "belt & suspenders" code in this business. Sometimes the caller doesn't know if the callee clears, so just to be safe...

Can't tell what the pgms are attempting, not much info. As I said the callee may be trying to access a file and the pgmmr didn't include a DD in the JCL (mainframe). Callee may be expecting a non-zero value, etc., who knows?

Jack.
 
Hi

from the main program in working storage:

call subprogram using w-invalid-records,w-valid-records


!! When calling you have the order invalid valid

in the subprogram linkage section:

c-valid-records pic 9(02).
c-invalid-records pic 9(02).


!! in likage section of subprogram you have valid invalid

procedure division using c-invalid-records,c-valid-records.

!! in using it's back to invalid valid

I don't think this is the problem causing the error code but it coult leeds to problem.

//Renaldini
 
Thankyou everyone for your help, I finally worked out what I was doing wrong - so simple. I was trying to add to my data items in the linkage section instead of to an accumulator first then moving the data in later. Anything that is being linked is very touchy.

Now I just have a date and time conversion problem that I do not know how to tackle.

Thankyou all

Carolly
 
Hi Carol,

Thanx for letting us know. How did you come to your conclusion, etc.? Enquiring minds want to know. :)

Were you doing a static or dynamic call? I would guess dynamic. I can't see why you can move, but not add data to the LS flds. Unless your compiler doesn't do it the same way as a Mainframe compiler.... interesting, I'll have to read up.

Regards, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top