Thankyou for the quick reply.
I tried in below way in taking the backup as suggested in one of the post in this forum and it worked fine.
The only issue i was facing is to get the DCB attributes of the file that is present in &&TEMP01 and pass it to OFILE.if i am testing for a single known file by giving proper DCB paremeters to OFILE, it is working fine. But my requirement is the PS file attributes keep on changing that is present in &&TEMP01.Sometimes it is FB,300LRECL, FB600LRECL,VB 450LRECL,VB670LRECL,etc.As suggested above, i cant keep the file name in a PDS member due to some security reasons.
//BUILDER EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=dataset with the name in it ,DISP=SHR
//SORTOUT DD DSN=&&TEMP001,DISP=(,PASS,DELETE),
// RECFM=FB,LRECL=80,
// SPACE=(CYL,(25,25),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL BUILD=(C' IDS(',1,44,1X,C') -',80:X)
/*
//*
//IDCAMS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//OFILE DD DSN=FILE NAME, Disp=(new,catlg,delete),space=... , dcb=....
//SYSIN DD *
PARM MARGINS(1 80)
REPRO -
// DD DSN=&&TEMP001,DISP=SHR
// DD *
OFILE(OFILE)
/*
//