* PROG.CMD - Add a more complicated program to the program file * STORE TRIM(CATEGORY) TO CAT STORE TRIM(TITLE) TO MTITLE STORE PARM TO PTYPE SELECT PRIMARY IF PTYPE = "S" STORE " " TO STYPE STORE "DSFILE" TO DSFILE USE &SYS&DSFILE GO BOTTOM STORE # TO LAST USE &SYS&DSFILE INDEX &SYS&DSFILE&ONE STORE "FILENAME,' ',FILE:DESC" TO FLIST STORE "CATEGORY = CAT" TO MATCH FIND &CAT STORE "The following files are available:" TO MDESC STORE "DSDISP" TO COMMAND DO &SYS&COMMAND IF !(RECORD)="Q" RETURN ENDIF GOTO &RECORD STORE FILENAME TO FNAME STORE FILE:DESC TO FDESC ENDIF IF PTYPE = "S" .OR. PTYPE = "C" STORE "DSADD" + PTYPE TO FMTNAME SET FORMAT TO &SYS&FMTNAME STORE " " TO ANSWER READ SET FORMAT TO SCREEN IF ANSWER = "NO" RETURN ENDIF ENDIF ERASE @ 1,10 SAY TMARK + " " + CNAME @ 3,10 SAY MTITLE IF PTYPE = "S" @ 5,10 SAY "File selected is " + FDESC ENDIF STORE " " TO PCODE IF PTYPE <> "G" @ 7,10 SAY "To create a new program enter a unique program code." ENDIF @ 8,10 SAY "To modify a current program enter a current program code." @ 10,10 SAY "Enter a program code " GET PCODE PICTURE "!!!" READ STORE "DSPROG" TO DSFILE USE &SYS&DSFILE SET INDEX TO &SYS&DSFILE&TWO,&SYS&DSFILE&ONE SET EXACT ON FIND &PCODE SET EXACT OFF IF # = 0 IF PTYPE = "G" @ 12,10 SAY "To modify menu information, you must enter an existing code." @ 13,10 SAY "Other programs are available to add new programs. Enter RETURN " @ 14,10 SAY "and you will be returned to the menus. Either choose another " @ 15,10 SAY "program to add your new program or select this program again " @ 16,10 SAY "after determining the correct program code." WAIT RETURN ENDIF APPEND BLANK REPLACE MENU:CODE WITH PCODE ENDIF IF PTYPE = "S" REPLACE CATEGORY WITH CAT REPLACE FILENAME WITH FNAME REPLACE PROGRAM WITH "DSSEAR" ENDIF IF PTYPE = "C" REPLACE CATEGORY WITH CAT ENDIF IF PTYPE = "M" REPLACE CATEGORY WITH "MNU" ENDIF STORE " " TO DEL @ 12,10 SAY "Enter or modify the program description which appears on the menu." @ 13,10 GET TITLE @ 15,10 SAY "You may place this program on any menu in the system. Please enter" @ 16,10 SAY "the exact code of the menu on which you want this program displayed." @ 17,10 SAY "If you do not know a valid menu code, use MAI for main menu. " GET MENU PICTURE "!!!" @ 19,10 SAY "Enter or modify the menu sequence code which determines the order" @ 20,10 SAY "in which programs are displayed on the menus. " GET MENU:SEQ @ 22,10 SAY "Enter 'DEL' in order to delete this program " GET DEL PICTURE "!!!" READ IF DEL = "DEL" DELETE SET INDEX TO PACK INDEX ON MENU+MENU:SEQ TO &SYS&DSFILE&ONE INDEX ON MENU:CODE TO &SYS&DSFILE&TWO RETURN ENDIF IF PTYPE = "M" .OR. PTYPE = "G" RETURN ENDIF STORE "DSPGM" + PTYPE TO FMTNAME SET FORMAT TO &SYS&FMTNAME READ SET FORMAT TO SCREEN IF PTYPE = "S" .AND. FORMAT <> " " ERASE @ 1,10 SAY TMARK + " " + CNAME @ 3,10 SAY MTITLE STORE " " TO ANSWER STORE TRIM(FORMAT) + ".FMT" TO SCREENFMT STORE FILE(SCREENFMT) TO DUP STORE FILE("DSPASS") TO XXX IF DUP @ 5,10 SAY "Screen format " + FORMAT + " already exists. You may use it or modify it." @ 6,10 SAY "Enter (U)se, (M)odify or just RETURN to choose another. " GET ANSWER PICTURE "!" READ IF ANSWER = "U" .OR. ANSWER = "M" IF ANSWER = "M" MODIFY COMMAND &SCREENFMT ENDIF ELSE STORE " " TO ANSWER @ 7,10 SAY "In order to use another screen format, select this program record" @ 8,10 SAY "again and enter a new screen format name. Enter RETURN " WAIT ENDIF ELSE STORE " " TO ANSWER @ 7,10 SAY "You have selected a new screen format, enter the format lines on the" @ 8,10 SAY "next screen. Enter a CTRL W when you have finished. Enter RETURN " WAIT SELECT SECONDARY USE MODIFY COMMAND &SCREENFMT SELECT PRIMARY ENDIF ENDIF IF PTYPE = "C" ERASE @ 1,10 SAY TMARK + " " + CNAME @ 3,10 SAY MTITLE STORE " " TO ANSWER STORE SYS + TRIM(PROGRAM) + ".CMD" TO COMMFILE STORE FILE(COMMFILE) TO DUP STORE FILE("DSPASS") TO XXX IF DUP @ 5,10 SAY "Command file " + PROGRAM + " already exists. You may use it or modify it." @ 6,10 SAY "Enter (U)se, (M)odify or just RETURN to choose another. " GET ANSWER PICTURE "!" READ IF ANSWER = "U" .OR. ANSWER = "M" IF ANSWER = "M" MODIFY COMMAND &COMMFILE ENDIF ELSE STORE " " TO ANSWER @ 7,10 SAY "In order to use another command file, select this program record" @ 8,10 SAY "again and enter a new command file name. Enter RETURN " WAIT ENDIF ELSE STORE " " TO ANSWER @ 7,10 SAY "You have selected a new command file, enter the command lines on the" @ 8,10 SAY "next screen. Enter a CTRL W when you have finished. Enter RETURN " WAIT SELECT SECONDARY USE MODIFY COMMAND &COMMFILE SELECT PRIMARY ENDIF ENDIF RETURN