Re: Duplicate input files




docdwarf@xxxxxxxxx wrote:
In article <1156007157.236585.153910@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Alistair <alistair@xxxxxxxxxxxxxxxxxxxxx> wrote:

Michael Mattias wrote:
"Alistair" <alistair@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1155990283.281332.182470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hardware/OS: IBM MVS
Cobol : Cobol II (Cobol 85 standard)


Down the pub last night a former colleague told me of a problem using
the same file via two DDs as input to a batch Cobol program. Under MVS
he gave each DD a disp=shr but received an error message preventing
successful execution. (Unfortunately, he's gone shopping so the exact
message is unspecified here). He resolved the problem by duplication of
the file so there would be no disp conflicts. Neither he nor I know of
any reason why duplicate DDs with disp=shr would fail. Has anyone got
any answer?

What failed? The JCL (program never starts) or the program?

The error message text might also be of interest when your colleague gets
back from the mall.

It seems that the program abended with a message stating (on attempting
to open the second file) that the file was already open. Beyond that he
can not recall. I suspect a program logic error but I wondered if Cobol
had a dislike of two sets of file handling routines pointing to the
same file. Somehow, I suspect Cobol is not at fault.

My memory is, admittedly, porous... but I recall having coded, just for
the testing of it, the equivalent of:

SELECT INPUT1 ASSIGN TO INFILE.
SELECT INPUT2 ASSIGN TO INFILE.
...

//INFILE DD DSN=SAME.DATASET,DISP=SHR

... and demonstrated that each internal name addressed the same external
dataset as though the other did not exist, viz.

OPEN INPUT INPUT1 INPUT2.
READ INPUT1. *> yields first record of SAME.DATASET
READ INPUT1. *> yields second rec.
READ INPUT2. *> yields first rec of SAME.DATASET
READ INPUT1. *> yields third rec.
READ INPUT1. *> yields fourth rec.
READ INPUT2. *> yields second rec.
READ INPUT2. *> yields third rec.

... et and cetera.

DD

Thanks Doc, so the theory works elsewhere. I'll pass this on to Anon
(Mr Michael P Brown) for his consideration. Ta.

.



Relevant Pages

  • Re: Duplicate input files
    ... SELECT INPUT1 ASSIGN TO INFILE. ... SELECT INPUT2 ASSIGN TO INFILE. ... *> yields first record of SAME.DATASET ... *> yields first rec of SAME.DATASET ...
    (comp.lang.cobol)
  • Re: Duplicate input files
    ... SELECT INPUT1 ASSIGN TO INFILE. ... SELECT INPUT2 ASSIGN TO INFILE. ... *> yields first record of SAME.DATASET ... *> yields first rec of SAME.DATASET ...
    (comp.lang.cobol)