Page 1 of 1

Select And DD Statments

PostPosted: Tue Nov 13, 2012 6:04 pm
by nameexists
Hi,

In my cobol program I have 2 select statements in the FILE-CONTROL of Environment Division. In first compile and link JCL I have 3 DD statements and in my second run JCL I have 4 DD statements, is this right? should I not have 4 DD statements in each. My first JCL is submitting ok, but my secound JCL is giving me a JCL ERROR CN(INTERNAL) . I was wondering has this got something to do with it.

Thanks

Re: Select And DD Statments

PostPosted: Tue Nov 13, 2012 6:18 pm
by Robert Sample
Compile and link JCL has no relationship to the SELECT statements in your program. Compile JCL will vary if -- AND ONLY IF -- you have COPY statements in your program and you need to include the SYSLIB DD statement to point to your copy book library (or libraries). Linkage editor / binder JCL will vary if you call subroutines with a static call and need to link them into your program load module.

Execution JCL will typically have a STEPLIB DD statement to point to the load library you compiled your program into, a SYSOUT DD for DISPLAY statements, and then 0, 1, or 2 (or more) DD statements per SELECT statement in your program. The actual number of necessary DD statements will depend upon how your program is coded and what type of files your SELECT statements are for.

Re: Select And DD Statments

PostPosted: Wed Nov 14, 2012 2:52 am
by NicC
just to clarify, I believe, 1 DD statement per SELECT.Y

Re: Select And DD Statments

PostPosted: Wed Nov 14, 2012 3:44 am
by dick scherrer
Hi Nic,

Is the .Y a typo?

There can be more than one dd statement for a SELECT.

d

Re: Select And DD Statments

PostPosted: Wed Nov 14, 2012 4:58 am
by Robert Sample
A VSAM KSDS with alternate index(es) defined that has the alternate index(es) defined to COBOL program in the SELECT ASSIGN clause will have MORE than 1 DD statement per SELECT. The base KSDS will have one DD statement, and each alternate index path will have a DD statement as well. If the base cluster ASSIGN is to a DD name of less than 8 characters, the alternate index path(s) will have the DD name appended with 1, 2, ..., 10, 11 .... If the base cluster ASSIGN is to a DD name of 8 characters, the last character becomes 1, then 2, through 9 after which the last 2 characters become 10, 11, etc.

Re: Select And DD Statments

PostPosted: Wed Nov 14, 2012 5:49 am
by BillyBoyo
Also simple concatenation will have more than one DD statement per SELECT. There will only be one named DD per select, however, for a concatenation.

A VSAM ESDS with an alternate index will also have more than one, named, DD statements per SELECT.