View previous topic :: View next topic
|
Author |
Message |
sarangwagh7
New User
Joined: 15 Mar 2007 Posts: 13 Location: Pune
|
|
|
|
Hi All,
In my program, the copybook name is runtime provided to CICS program, how can I access that copybook variables just by knowing the copybook name as a literal in program??
The requirement is :
From front screen we are getting the copybook name only and in CICS program we need to find out the variables defined in that copybook and send those variables to maps.
I am not able to access the copybook variables(expanded copybook) as I am getting the name of copybook in program at runtime.
Thanks,
Sarang |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Probably, first you need to find out the list of copybooks that are supposed to be populated from online. Include all these copybooks in the program and change the program to handle the copybook name entered via online and depending on the copybook name decide your further processing in your program. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
The requirement is : |
I would say that the requirement is a little bit confusing/incomplete :-)
( assuming that the application is written in COBOL or PL/I )
A copybook ( in the sense used in this thread ) is the description of the record layout ...
WRITTEN ACCORDING TO THE SPECIFICATIONS OF THE PROGRAMMING LANGUAGE USED
(sentence capitalized to point out the environment )
Unless You implement in the application the same parsing logic of the programming language of the copybook
( i.e. a small piece of the compiler)
You will find out that the copybook, as it is, will be of very little use to You...
and it is not easy to write a generalized function/subroutine to achieve what You ask for
Just a few questions
( to point out the problems and help to better define the requirement )...
where would You store the copybook source,
How would You parse to find out the varable names and their types..
what about mapping different layouts for different record types in the same copybook
how to build a nameless map to accept generic data
what descriptions to provide for the fields displayed on the screen
what about keyed access to the data ( You wouldn' t want to read everything !!)
... and many more ...
Unless something was missing in the O/P at the moment I do not see any
other way...
UNLESS...
the copybooks relate to SQL tables...
the tables are defined with the proper comments..
You queried the SYSIBM.things to find out the table layout
build dynamically the query to retrieve the data You want to display
and .... and ....
but then why rewrite QMF ??
The easiest and quickest approach is to write a subroutine and a map
for each record layout that You want to display
maybe a dynamicall LINKED program with the same name as the copybook
get the name of the copybook==program
check in a table if a disply function is provided , or - fastest -
intercept the "exec cics LINK" error for program not found
and ... ... ...
decide if reandom or sequential access
and ... ... |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
Sounds to me like your requirement may have come from a Java programmer who is keen on using "reflection".
Check out the XML GENERATE and XML PARSE commands. These commands are relatively new to COBOL and it could be that your installation does not have access to them.
As Srihari already mentioned, you'll need to COPY in all possible copybooks.
Having thrown that suggestion out there, I agree with Enrico's feeling that the requirements here may not be well stated or understood.
As a alternative, consider using REXX to parse your copybooks. You can call REXX from a COBOL program. Consider running your copybooks through a REXX parser that outputs the data you want into 1 consolidated copybook - or perhaps pump the data into a file or database... |
|
Back to top |
|
|
sarangwagh7
New User
Joined: 15 Mar 2007 Posts: 13 Location: Pune
|
|
|
|
Dear All,
Thanks a Lot for your nice suggestions.
I am trying some clues from that.
But just to clear you the requirements again :
I am developing one tool which tests online programs.
So from CICS, i will invoke the transaction which is testing the service prog, provided with the program name which is to be test, and the input copybook.
Then at the back end, my program will send the Map according to copybook provided on CICS. So user will enter the require input fields on MAP, and my program will call the service program with the data input on map. execute it and throw the results on map ( whether it is successful or not)
As Input copybooks are different for different progs, i need to take the provided copybook in my program at run time, their I am getting stucked as i am getting copybook name at runtime as a literal in Linkage section.
Hope you understood now the situation.
If you get any idea how to generalize the test tool, your ideas are always welcome.
Thanks,
Sarang |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe your requirement is understood.
Quote: |
I am getting stucked as i am getting copybook name at runtime |
Yes, this will probably be the most difficult part of getting your tool to do what you want.
It is far from trivial to "compile" a copybook on the fly in some user applicaton code (which is what your tool is). |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
What you are trying to do is very ambitious. Do NOT let us dissuade you as there will always be people who say that something cannot be done.
However, as you spend time and effort on this keep an eye on whether you are achieving your objectives.
Sometimes simple/specific is better than complex/generic. |
|
Back to top |
|
|
|