Unidata McIDAS-X Training Workshop

REM ? GETSYS.MCB - Save important System Key Table values in the ASCII text file
REM ?
REM ? Name:    GETSYS.MCB
REM ?
REM ? Purpose: Save important System Key Table values in the ASCII text file
REM ?          SYSVAL.LST
REM ?
REM ? Invocation:
REM ?          RUN FILE=GETSYS.MCB
REM ?
REM ? Comment: GETSYS.MCB is designed to save values from SYSKEY.TAB so that
REM ?          they can be restored after running (accidentally or not) the
REM ?          SYSKEY command.  Unidata uses SYSKEY values in the range of
REM ?          1-100, 800-1000, and 2000-2200.
REM ?
REM   History: 92???? - Created for Unidata McIDAS-OS2 Version 5.60
REM            940715 - Updated comments for online documentation
REM            940808 - Modified to save all non-missing values between 1-1000 
REM                     and 2000-2400
REM ? ----------

REM Open the ASCII output file SYSVAL.LST
OPEN "SYSVAL.LST",1

REM Save SYSKEY values in locations 1-100
100 S = 1
110 N = 100
120 GOSUB 1000 

REM Save SYSKEY values in locations 800-1000
200 S = 800
210 N = 200
220 GOSUB 1000 

REM Save SYSKEY values in locations 2000-2400
300 S = 2000
310 N = 400
320 GOSUB 1000 

REM Close output file and stop
997 PRINT "Done saving SYSKEY values to SYSVAL.LST"
998 CLOSE 1
999 STOP

REM Subroutine that writes the values to SYSVAL.LST
1000 IF N = 0 RETURN
1010 J = KSYS(S)
1020 IF J = -2139062144 GOTO 1090
1030 PRINT "Saving SYSKEY value at location: ";S
1040 IF J < 99999 GOTO 1080
1050 J$ = KSYS$(S)
1060 PRINT @1,S;" ";J$
1070 GOTO 1090
1080 PRINT @1,S;" ";J
1090 S = S + 1
1100 N = N - 1
1110 GOTO 1000