View previous topic :: View next topic
|
Author |
Message |
indraraghav
New User
Joined: 06 Jun 2005 Posts: 4 Location: chennai
|
|
|
|
Hi,
Can we read a sequential file in the COBOL program without defining the DD name for the file in JCL. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Something has to point to the dataset, what more specificly is your need? |
|
Back to top |
|
|
indraraghav
New User
Joined: 06 Jun 2005 Posts: 4 Location: chennai
|
|
|
|
Yes, Bill.
But for the below condition, I think, it error out with 'FILE NOT FOUND'. Please let me know ur views.
1. Program tries to open the file.
1. DD card of JCL is commented out. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Could be, but I thought it was more like a u4038...... |
|
Back to top |
|
|
adarsha
New User
Joined: 28 Dec 2006 Posts: 8 Location: Noida,Delhi
|
|
|
|
This can be done by coding OPTIONAL command in the application program in the Enironment Division.
Ex
:
:
:
:
ENIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OPTIONAL (file-name> ASSIGN TO <assigning-name>.
.......
after this you need not to give the DD name....
the system automatically understand the file is irtual and executes with RC=0.
But this is not for IBM mainframes... its an enhanced parameter for HP-Systems only!!! |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
adarsha wrote: |
SELECT OPTIONAL (file-name> ASSIGN TO <assigning-name>.
.......
But this is not for IBM mainframes... its an enhanced parameter for HP-Systems only!!! |
Quoth the Fine Language Reference:
Quote: |
SELECT OPTIONAL
Can be specified only for files opened in the input, I-O, or extend mode. You must specify SELECT OPTIONAL for those input files that are not necessarily present each time the object program is executed. For more information, see the Enterprise COBOL Programming Guide.
file-name-1
Must be identified by an FD or SD entry in the data division. A file-name must conform to the rules for a COBOL user-defined name, must contain at least one alphabetic character, and must be unique within this program. |
|
|
Back to top |
|
|
|