IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reading a sequential file in program with INPUT DD name


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
indraraghav

New User


Joined: 06 Jun 2005
Posts: 4
Location: chennai

PostPosted: Tue Jan 16, 2007 3:47 pm
Reply with quote

Hi,

Can we read a sequential file in the COBOL program without defining the DD name for the file in JCL.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:09 pm
Reply with quote

Something has to point to the dataset, what more specificly is your need?
Back to top
View user's profile Send private message
indraraghav

New User


Joined: 06 Jun 2005
Posts: 4
Location: chennai

PostPosted: Tue Jan 16, 2007 4:16 pm
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:22 pm
Reply with quote

Could be, but I thought it was more like a u4038......
Back to top
View user's profile Send private message
adarsha

New User


Joined: 28 Dec 2006
Posts: 8
Location: Noida,Delhi

PostPosted: Tue Jan 16, 2007 7:49 pm
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 8:10 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top