Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading a sequential file in program with INPUT DD name

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Reading a sequential file in program with INPUT DD name
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:09 pm    Post subject:
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    Post subject: Re: Reading a sequential file in program with INPUT DD name
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 4:22 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Tue Jan 16, 2007 8:10 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us