RE: Cobol Select and Assign [1 Attachment]

"John R. Macdonald" <[email protected]> Thu, 17 Jun 2010 04:47:00 +0200
Newsgroups gmane.comp.emulators.turnkey-mvs
Organization Home
Message-ID <00e201cb0dc7$5c9d0b40$15d721c0$@fr>
Ron
The old (e.g. MVT) COBOL compilers used a system name in the SELECT statement which included: device class - organisation - DD name
SELECT SOMEFILE ASSIGN TO UT-S-DDNAME1
the device classes are:
UR for Unit Record (card reader/punch and printer devices)
UT for a UTility device (generally tape devices or PS disk)
DA for Direct Access devices   
the organisation could have the following values:
S for sequential
D for direct access
I for  ISAM (Indexed Sequential Access Method)
IIRC under DOS you could (or had to) specify the device number (2314, 2400, 1403 etc) after the device class.  ==>  SELECT SOMEFILE ASSIGN TO UT-2400-S-SYS010
I seem to remember the early DOS compilers needed this information but that was 40+ years ago.
 Under the various incarnations of OS/360 it was not necessary.
The DD name of course links the actual file to the file in your program which leads to the next remarks I'd like to make concerning your JCL example
//DDREG DD DSN=HUDSON.DATA.-DATA(CHKREG)-,DISP=SHR
//SYSPRINT DD SYSPRINT=A
First I hope the "-DATA(CHKREG)-" is a typo
When writing a DD statement for an existing and catalogued input file I quickly learned it was more efficient to place the DISP parameter before the 
DSN parameter especially when the length of the dataset name could frequently change as there was no need to rekey the DISP parameter.
//DDREG DD DISP=SHR,DSN=HUDSON.DATA.DATA(CHKREG)   moving into acceptance or production
//DDREG DD DISP=SHR,DSN=HUDSON.DATA.TESTDATA(CHKREG) for instance or
//DDREG DD DISP=SHR,DSN=HUDSON.PRODUCTN.FY10DATA(CHKREG05)
(I won't go into using JCL symbols)
also coding only one parameter (or 2 max) per card image for longer statements helps in the long run
 
I don't really see the need to include 'DD' as part of the DDNAME as that doesn't really tell you anything you don't already know. 
Some of the shops I've worked for had standards where your DDREG would have been IFREG (for Input File) or ISREG (Input Sequential) or similar
which helps when you're reading JCL you are not familiar with without peeking into the source program, as OS allows you to overwrite an existing 
file if the JCL is setup that way.
For instance which is the input file and the output file?
//THISFILE    DD DISP=OLD,DSN=DSNAME1
//SOMEFILE DD DISP=OLD,DSN=DSNAME2
contrast with
//OFFILE DD DISP=OLD,DSN=DSNAME1
//IFFILE   DD DISP=OLD,DSN=DSNAME2
 
I know you are writing in COBOl but I don't recommend using SYSPRINT as a DDNAME. It is the standard output file for PL/I (COBOL uses SYSOUT) and 
most utilities so if your COBOL program calls a PL/I subprogram you could end up with 'interesting' results.
It is also not very informative. A reader will guess it references printed output but which output? Your checkbook output or your run/error log?
//CHKREPRT DD SYSOUT=* for instance might be more useful to a (human) reader
 
Also the second SYSPRINT in your SYSPRINT statement is not a DD parameter. Your statement should read
//SYSPRINT DD SYSOUT=A 
 
HTH
John
 
 
UT means a "unit record" device. S means sequential, as the second message assumed. 
 
 
 
From: [email protected] [mailto:[email protected]] On Behalf Of Ron Hudson
Sent: Wednesday, June 16, 2010 3:39 PM
To: [email protected]
Subject: Re: [turnkey-mvs] Cobol Select and Assign
 
 
 
 
 
what kind of magic is "UT-S-<my original name>"
 
Do I refer to them in runtime JCL as:
 
//DDREG DD DSN=HUDSON.DATA.-DATA(CHKREG)-,DISP=SHR
//SYSPRINT DD SYSPRINT=A
 
??
 
 
 
On Wed, Jun 16, 2010 at 2:27 PM, Jean-Marie Bodin <jeanmarie.bodin@ <mailto:[email protected]> -free.fr> wrote:
 
  
 
Hi
 
 
 
Try this
 
 
 
00007           INPUT-OUTPUT SECTION.
00008           FILE-CONTROL.
00009               SELECT REGISTER-FILE
 
00010                  ASSIGN TO UT-S-DDREG.
00012               SELECT REPORT-FILE
00013                  ASSIGN TO UT-S-SYSPRINT.
 
jm
 
----- Original Message ----- 
 
From: Ron Hudson <mailto:[email protected]>  
 
To: turnkey-mvs@ <mailto:[email protected]> -yahoogroups.-com 
 
Sent: Wednesday, June 16, 2010 8:17 PM
 
Subject: [turnkey-mvs] Cobol Select and Assign
 
 
 
Hi everyone,
 
I apologize to those I annoy - I have been Googling to try to find answers and
basically only find frustration.
 
 
I thought this would be easier - a checkbook totaling program written in cobol. 
 
I want to read a file specified in my JCL and produce printed lines on the printer.
I will also be reading a number from each record and keeping several sums.
 
Right now I am having problems specifying the file my program will interact with. Also
the printer.
 
I have read all over the place, but I think most of what I have read pertains to newer
versions of cobol.
 
00003   000700  ENVIRONMENT DIVISION.                                                 00
 
 
 
 
 
 
00004           CONFIGURATION SECTION.
 
 
00005   000800  SOURCE-COMPUTER. IBM-370.                                             00
 
 
00006   000900  OBJECT-COMPUTER. IBM-370.                                             00
 
 
 
 
 
 
 
00007           INPUT-OUTPUT SECTION.
 
 
00008           FILE-CONTROL.
 
 
00009               SELECT REGISTER-FILE
 
 
00010                  ASSIGN TO DDREG
 
 
00011                  ORGANIZATION IS SEQUENTIAL.
 
 
00012               SELECT REPORT-FILE
 
 
 
 
 
 
 
00013                  ASSIGN TO SYSPRINT.
 
And this is what cobol says about it....
 
 CARD   ERROR MESSAGE
 
 
 
 
 
 11     IKF1155I-W     DEVICE CLASS INVALID IN SYSTEM-NAME. SKIPPING TO NEXT FIELD.
 
 
 
 
 
 
 11     IKF1141I-W     FILE ORGANIZATION FIELD INVALID IN SYSTEM-NAME.  SEQUENTIAL ASSUMED.
 
 
 11     IKF1157I-E     EXTERNAL-NAME NOT PRESENT IN SYSTEM-NAME.
 
 
 11     IKF1017I-E     IS INVALID IN SELECT CLAUSE. SKIPPING TO NEXT CLAUSE.
 
 
 
 
 
 
 
 13     IKF1155I-W     DEVICE CLASS INVALID IN SYSTEM-NAME. SKIPPING TO NEXT FIELD.
 
 
 13     IKF1141I-W     FILE ORGANIZATION FIELD INVALID IN SYSTEM-NAME.  SEQUENTIAL ASSUMED.
 
 
 13     IKF1157I-E     EXTERNAL-NAME NOT PRESENT IN SYSTEM-NAME.
 
 
 
 
 
 
 
 9      IKF2133I-W     LABEL RECORDS CLAUSE MISSING. DD CARD OPTION WILL BE TAKEN.
 
 
 
 
There are a bunch of other messages, but I think they are triggered by these.  I have tried several things 
for both the register-file and the report-file (actually - the printer I hope) instead of SYSPRINT I have had
PRINTER, and instead of DDREG I have had DISK and FILE.
 
Ron.
 
 
 
 
 
 
 
 
 
 
 

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.829 / Virus Database: 271.1.1/2940 - Release Date: 06/16/10 08:35:00
~WRD000.jpg (application/octet-stream, 826 B) - not displayed
signature.asc (application/pgp-signature, 489 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)

iQEcBAABAgAGBQJMGYyiAAoJEA1DTQ4gHt4tEYMH/1FHuM4DslNeS3lx7zyT6I5k
zZ9lgAd0H2bEpqOOMFxWKAcRMShjdXxO5wUPfxxpk6OfTN1WjQGI+Z9/JCuQPaUv
QFzv63uYt0LCo6V4WIUtOP0bcUc8qthISC6UAHgnBbfkN7ZVZV/jH3n8wVKZoRxq
8J1gAegmPzi1TWgAfg3pRtKL7wIRsrRRjChGjxAurAgQvg+uPsJOT4xNX6wLL5OY
QUfuQKYw1H+M6n62OSLHl1LXFBwZo+Bj3ZUlbPB58EIAMLkSIttII/GpVd7qr9wv
d1eXqionH6sAD7PnYX22cdziBk2jwkPfHJy8LVSz9pOsBIWIHUWgqFnlPvmDdT4=
=WD5L
-----END PGP SIGNATURE-----