Is there a way to check existence of file in MVS before attempting copy to Unix server

201 views Asked by At

A file to be copied from MVS Mainframe to Unix server using Connect Direct. Below is the sample script which works fine. Now before copying the file is there a way to verify the file existence in MVS ?

submit FILE_COPY process
SNODE=${SENDING_NODE} SNODEID=(${USERNAME},${PASSWORD})
&INDSN="$INPUT_FILE"
&OUTDSN="$OUTPUT_DIR$OUTPUT_FILE"

COPYSTEP COPY FROM (FILE="&INDSN")
  TO
      (FILE="&OUTDSN"
        UNIT=SYSDA
        SYSOPTS=":datatype=text:"
        DISP=RPL
        SPACE=(TRK,(100,50),RLSE)
        DCB=(RECFM=FBA,LRECL=216,BLKSIZE=0)
        pnode)
    
PEND;
EOF
1

There are 1 answers

0
NicC On BEST ANSWER

Yes - if you are running in batch. Simply have a step before your C-D step to execute IDCAMS and print tthe first line of the dataset. If the dataset is not found a non-zero return code is set. Just check that in the EXEC statement of your C-D step. (If you had tagged this with Mainframe I would have seen this 2 weeks ago.)