2010年12月20日 星期一

Dynamic file allocation on IBM mainframe

Alloc_Routine:
/**********************************************************/
/* DSN is passed as a parm when Alloc_Routine is called */
/**********************************************************/
ARG dsn_name .


DSN_status = SYSDSN(dsn_name)


If DSN_status = "OK"
Then Do
"ALLOC DSN('"dsn_name"') OLD REUSE"
AllocRC = RC
Else Do
"ALLOC DSN('"dsn_name"') NEW CATLG SPACE(CYL,1,1) UNIT(SYSDA)" ,
"LRECL(80) BLKSIZE(0)..."
AllocRC = RC
End


If AllocRC = 0
Then Nop
Else Say "Unable to Allocate DSN("dsn_name"), RC="AllocRC


Return AllocRC