Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

regarding moving data between variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: regarding moving data between variables
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    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Mon Jul 12, 2010 5:32 pm    Post subject:
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    Post subject: Reply to: regarding moving data between variables
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: 7936
Location: Bellevue, IA

PostPosted: Mon Jul 12, 2010 7:35 pm    Post subject:
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    Post subject:
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: 7936
Location: Bellevue, IA

PostPosted: Tue Jul 13, 2010 3:45 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us