View previous topic :: View next topic |
Author |
Message |
patnekar Beginner
Joined: 27 Jan 2003 Posts: 41 Topics: 16
|
Posted: Wed May 21, 2003 11:09 pm Post subject: File handling in COBOL |
|
|
Is it possible to assign open a file in a COBOL pgm, with the file name being assigned thru a variable?? Eg. I have a file, which has multiple records. Each record is the name of other files existing in the system. Now I read the first record of this file, assign it to a variable and now want to open the file to which the variable name corresponds to.
Sample code would be of great help.
Thanks
Puru |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Wed May 21, 2003 11:24 pm Post subject: |
|
|
Puru,
I am not aware of variable names in the SELECT clause. But, there are routines for dynamic allocation of a dataset. It is there in some manual. I cannot look into it now.
(This is not an answer. But, just a thought, I wanted to share.) _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
Premkumar Moderator
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
|
Back to top |
|
|
satjag Beginner
Joined: 19 Dec 2002 Posts: 19 Topics: 2
|
Posted: Thu May 22, 2003 3:59 am Post subject: |
|
|
Puru,
After opening a particular file(say FILE1) after reading the name from the file-master(file having dd names of files in the system),what are you intending to do with it ? Does the program action differ accordingly ? _________________ Regards,
satjag |
|
Back to top |
|
|
patnekar Beginner
Joined: 27 Jan 2003 Posts: 41 Topics: 16
|
Posted: Thu May 22, 2003 8:17 am Post subject: |
|
|
Satjag,
After opening a file, I'll be sorting it. Yes the sort conditions vary depending on the file opened.
Thanks
Puru |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Thu May 22, 2003 11:06 pm Post subject: |
|
|
Hi Puru,
If you're intending to use an internal sort with COBOL variables as SORT keys, you may run into problems if the psitions of the keys change with the dataset being processed.
Another possible solution is to write a pgm that creates JCL (Jobs) and their associated SORT cntl cards. Each job executes a SORT step.
The JCL is written to an internal reader [//JCLOUT DD SYSOUT=(,INTRDR)] and the cntl cards are written to a PDS. The JCL is a job that executes SORT for the dataset name (SORTIN) read from your I/P file the cntl cards are written to a different member name for each SORT. You use one of the techniques mentioned earlier to write a cntl card member for each DSN read from the I/P.
The JCL written to the INTRDR is automatically submitted to the JES Q and executed.
Regards, Jack. |
|
Back to top |
|
|
sivasibm@yahoo.co.in Beginner
Joined: 31 Jul 2003 Posts: 2 Topics: 0 Location: India
|
Posted: Fri Aug 01, 2003 4:41 am Post subject: |
|
|
what is the usage of 88 level entry?
I am a beginner/
anybody please reply.
Thanks,
sai. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Fri Aug 01, 2003 2:47 pm Post subject: |
|
|
Siva,
The level-number specifies the hierarchy of data within a record, and identifies special-purpose data entries. A level-number begins a data description entry, a renamed or redefined item, or a condition-name entry. A level-number has a value taken from the set of integers between 1 and 49, or from one of the special level-numbers, 66, 77, or 88.
Level 88 is used for Identifying any condition-name entry that is associated with a particular value of a conditional variable.For ex:
Check this link for an example of using conditional name
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.5.1.2.4?SHELF=&DT=20020923143836
I would suggest that you read the following manuals:
COBOL Language Reference
cOBOL Programming Guide
Hope this helps...
cheers
kolusu |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Mon Aug 11, 2003 7:56 am Post subject: |
|
|
Puru,
Is it that there is a set of 'n' number of files out of which some maybe present and some maybe not? Or, is it that, you have no "control" on the file names and the number? Is the processing going to be different depending on the filenames? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
sivasibm@yahoo.co.in Beginner
Joined: 31 Jul 2003 Posts: 2 Topics: 0 Location: India
|
Posted: Thu Aug 14, 2003 5:49 am Post subject: |
|
|
what is packed decimal and zoned decimal?
regards,
sai. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
|
|