USING CAdi QUERY TO MAIL MESSAGE TO USERNAME CONTAINED IN FIELD


COURSE file has .USERNAME field (name of person who added the Course). How do  we use the data in the .USERNAME field as the recipient of an email message, such as:
$ MAIL/SUBJECT="CRSEID$ was deleted from Course file" CRSDEL_NOTIFY.LIS USER$

We do not want the current USERNAME$ (person running the program) but rather the USERNAME field data in the COURSE file for the selected record, i.e., not this:
* EQUATE <$USER$> <...USER>

This can be done using CAdi commands...

$ CADI QUERY/OUTPUT="CRS/LOGICAL" COURSE "MATH1301 01033S" USERNAME

CAdi queries the file COURSE for the courseid specified and returns the value of the field .USERNAME to the logical CRS_1 (Since there was only one field requested.)

$ MAILTO = F$TRNLNM("CRS_1")

Sets the variable MAILTO to the value of the logical CRS_1

$ MAIL/SUBJECT="Course MATH1301 01033S has been deleted" BODY.EMAIL 'MAILTO

Sends a mail message to the MAILTO variable with the specified subject and uses a pre-defined file BODY.EMAIL as the content of the message.

This is only a valid option for PX Clients with CAdi installed (which comes with CampusConnect).


Greg Pinkston
Software Specialist
11415 East 19th Street, Suite B
Tulsa, OK 74128-6412