IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

regarding moving data between variables


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Mon Jul 12, 2010 5:04 pm
Reply with quote

Hi Guys,

I have a set of programs (say A,B,C,D....) which call program BCE807ST

as follows:

CALL 'BCE807ST' USING
FROM-FIELD
TO-FIELD
LENGTH
var11
var22


Program BCE807ST is used to move data from the FROM-FIELD to the TO-FIELD.

Now I am facing the following problems:
1) All programs are not passing Var11 and Var22 as parameters to BCE807ST. So the programs which are not passing these parameters how do I define default values for these parameters in BCE807ST ?
(as we cannot have value clause in the linkage section)


2) The length of the variables passed from the calling program is not fixed.
For example:
FROM-FIELD can be PIC X(10) to PIC X(10000)

I dont want to use PIC X(10000) in program BCE807ST if data passed from calling program has data type PIC X(10).

can you please suggest me a way to do so using pointers wherein i dont need to haed code the length of the variables passed to the program BCE807ST?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 12, 2010 5:18 pm
Reply with quote

instead of passing 5 parms,
why not pass one parm? - a structure (copybook defining all fields necessary)
to include the fields containing the length of FROM-Field and to-field.

obviously FROM-FIELD and TO-FIELD must be defined in the structure as 10,000.

also, keep in mind that the FROM/TO-FIELDs defined in the structure,
are working storage of the CALLing programs and are linkage of the CALLed programs.

I would also suggest having some type of FUNCTION field defined in the structure.

you have asked about using pointers; this can easily be done, by someone with experience. That you have asked, shows you have little.
I am not begrudging your experience, but I feel that you are over complicating the task.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 12, 2010 5:32 pm
Reply with quote

You need to be aware that COBOL generates pseudo-assembler code based on what you indicate you are doing. Passing a 10-byte variable will require only one address register to access the data; passing a 10000-byte variable will require three address registers to access the data. Unless you follow Dick's suggestion and include lengths of fields as part of the structure you pass to BCE807ST, you have an excellent chance of getting S0C4 abends.
Back to top
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Mon Jul 12, 2010 7:27 pm
Reply with quote

Hi Guys,

Due to some constraints I am not allowed to make any changes to the parameters passed from the calling programs or rather i do not have the authority to make any changes to the calling programs.

So now I need to know:

Can I have default values set for variables var11 and var22 in my called program BCE807ST, as some of the calling programs do not pass these parameters to BCE807ST?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 12, 2010 7:35 pm
Reply with quote

Although I haven't tested this, you SHOULD be able to use
Code:
IF ADDRESS OF var22 = NULL
.
.
.
IF ADDRESS OF var11 = NULL
to check for these variables not being passed and take appropriate action.
Back to top
View user's profile Send private message
Amb

New User


Joined: 12 Mar 2010
Posts: 64
Location: India

PostPosted: Tue Jul 13, 2010 10:02 am
Reply with quote

thanks Robert...

the above code is working...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Jul 13, 2010 3:45 pm
Reply with quote

Glad to hear that -- thanks for letting us know.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top