![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: Can a DCL command file be used to copy 2 files and give them new names based on a combination of the user's input variable value and a constant value contained in the script? i.e. user enters a file name of 20040831 in response to a prompt and the DCL command procedure copies File1.lis and the procedure names the file EFT20040831.LIS and procedure copies File2.lis and procedure names the file ABC20040831.LIS I have tried using the manual's Basic example for STR$CONCAT and can't get this to work. The Answer is : Both BASIC sommands followed by a call to the convert library (the callable copy mechanism) or followed by a call to lib$spawn can be used from within an application. (The OpenVMS WIzard will assume that one or more BASIC applications are in use here, as the BASIC RTL call does not generally involve DCL and DCL commands such as COPY -- applications written in BASIC and in DCL will use entirely different commands and different syntax, of course.) Within DCL itself, you would typically use symbols for the specified task: $ READ/PROMPT="Enter value" SYS$COMMAND tag $ COPY file1.lis EFT'tag'.lis $ COPY file1.lis ABC'tag.lis The application can also be coded to create the file under other names automatically, using either system service or RTL calls from directly within the BASIC application, or using DCL lexical functions from within the DCL command procedure. A DCL example follows: $ usrnam = F$GetJPI(0,"USERNAME") $ prcidx = F$Fao("!4XW",- F$GetSYI("MAXPROCESSCNT")-F$GetJPI("0","PROC_INDEX")) $ suffix = F$Edit("''usrnam'_''prcidx'","COLLAPSE,UPCASE") $ COPY file1.lis EFT'suffix'.lis $ COPY file1.lis ABC'suffix'.lis Examples of DCL code abound here in Ask The Wizard, as well as in various areas referenced by the OpenVMS FAQ, as well as in the OpenVMS User's Manual, and in the Digital Press Writing Real Programs in DCL book.
|