MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File handling in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
patnekar
Beginner


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Wed May 21, 2003 11:09 pm    Post subject: File handling in COBOL Reply with quote

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
View user's profile Send private message Yahoo Messenger
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed May 21, 2003 11:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Thu May 22, 2003 3:31 am    Post subject: Reply with quote

Here is an article on Dynamic File Allocation with COBOL.
Back to top
View user's profile Send private message Send e-mail
satjag
Beginner


Joined: 19 Dec 2002
Posts: 19
Topics: 2

PostPosted: Thu May 22, 2003 3:59 am    Post subject: Reply with quote

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
View user's profile Send private message
patnekar
Beginner


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Thu May 22, 2003 8:17 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Thu May 22, 2003 11:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
sivasibm@yahoo.co.in
Beginner


Joined: 31 Jul 2003
Posts: 2
Topics: 0
Location: India

PostPosted: Fri Aug 01, 2003 4:41 am    Post subject: Reply with quote

what is the usage of 88 level entry?

I am a beginner/

anybody please reply.
Thanks,
sai.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Aug 01, 2003 2:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Aug 11, 2003 7:56 am    Post subject: Reply with quote

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
View user's profile Send private message
sivasibm@yahoo.co.in
Beginner


Joined: 31 Jul 2003
Posts: 2
Topics: 0
Location: India

PostPosted: Thu Aug 14, 2003 5:49 am    Post subject: Reply with quote

what is packed decimal and zoned decimal? Rolling Eyes

regards,
sai.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Thu Aug 14, 2003 5:53 am    Post subject: Reply with quote

sivasibm@yahoo.co.in,

If you had gone thru the programming guide above you wouldn't be asking such a basic question.Please do some homework. any way here is the link to the various formats of numeric data.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.3.4?DT=20020923143836

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group