home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR21 / DOCPRC13.ZIP / SAMP-DOC.ZIP / FORTRAN.DOC < prev    next >
Text File  |  1992-10-26  |  33KB  |  408 lines

  1.                                                                                 
  2.                                                                                 
  3.                                                                                 
  4.                                                                                 
  5.                                                                                 
  6.                                                                                 
  7.                                                                                 
  8.                                                                                 
  9.                                                                                 
  10.                                                                                 
  11.                                                                                 
  12.                                                                                 
  13.                                                                                 
  14.                     *********************************************               
  15.                     *                                           *               
  16.                     *           A STUDENT APPROACH TO           *               
  17.                     * FORTRAN ON AN IBM MVS/XA OPERATING SYSTEM *               
  18.                     *                                           *               
  19.                     *********************************************               
  20.                                                                                 
  21.                                                                                 
  22.                                                                                 
  23.                                                                                 
  24.                                                                                 
  25.                                                                                 
  26.                                                                                 
  27.                                                                                 
  28.                                                                                 
  29.                                                                                 
  30.                                                                                 
  31.                                                                                 
  32.                                                                                 
  33.                                                                                 
  34.                                                                                 
  35.                                                                                 
  36.                                                                                 
  37.                                                                                 
  38.                                                                                 
  39.                                                                                 
  40.                                                                                 
  41.                                                                                 
  42.                                                                                 
  43.                                                                                 
  44.                                                                                 
  45.                                                                                 
  46.                                                                                 
  47.                                                                                 
  48.                                                                                 
  49.                                                                                 
  50.                                                      John S. Ward               
  51.                                                         03/10/93
  52.  
  53. EJECT                                                                           
  54.         In this handout we follow step-by-step instructions in creating         
  55.    a FORTRAN program.  Job Control Language (JCL) is used to demonstrate
  56.    file linkage as well as program execution.  For the purpose of this
  57.    handout, we assume you have successfully accessed the ISPF/PDF               
  58.    PRIMARY OPTION MENU shown below:                                             
  59.                                                                                 
  60.                 GEORGIA STATE UNIVERSITY COMPUTER CENTER                        
  61.     --------------------ISPF/PDF PRIMARY OPTION MENU-----------------------     
  62.    OPTION ===>                                                                  
  63.                                                            USER ID  -userid     
  64.     0  ISPF PARAMS -Specify terminal and user parameters   TIME     -14:42      
  65.     1  BROWSE      -Display source data or output listing  TERMINAL -3278       
  66.     2  EDIT        -Create or change source data           PF KEYS  -24         
  67.     3  UTILITIES   -Perform utility functions                                   
  68.     4  FOREGROUND  -Invoke language procedures in foreground                    
  69.     5  BATCH       -Submit job for language processing                          
  70.     6  COMMAND     -Enter TSO command or CLIST                                  
  71.     7  DIALOG TEST -Perform dialog testing                                      
  72.     8  LM UTILITIES-Perform library management utility functions                
  73.     C  CHANGE      -Display summary of changes for this release                 
  74.     T  TUTORIAL    -Display information about ISPF/PDF                          
  75.     X  EXIT        -Terminate ISPF using log and list defaults                  
  76.                                                                                 
  77.    Enter END command or PF3 to terminate ISPF.                                  
  78.                                                                                 
  79.                                                                                 
  80.                                                                                 
  81.    SECTION ONE: Creating your FORTRAN program.                                  
  82.                                                                                 
  83.                                                                                 
  84.     1.1) Enter 6 at the "OPTION ===>" prompt of the ISPF/PDF PRIMARY OPTION     
  85.          MENU, and hit return to go to TSO COMMAND PROCESSOR panel.             
  86.                                                                                 
  87.     1.2) Type CREATE at the cursor, and hit return.  Next, type your initial
  88.          when you are asked to "ENTER LIBRARY/APPLICATION NAME  ===>".  Hit
  89.          return, and type FORTRAN at the next prompt.   Hit return one more
  90.          time when you see three asterisks displayed (hit return anytime        
  91.          you see *** displayed).                                                
  92.                                                                                 
  93.     1.3) Use the F4 key to go back to the primary menu.  Then, enter 2 at       
  94.          the "OPTION ===>" prompt to go to the EDIT - ENTRY PANEL.              
  95.          Fill the sections of this panel as shown below:                        
  96.                                                                                 
  97. EJECT                                                                           
  98.    ------------------------- EDIT - ENTRY PANEL ---------------------------     
  99.    COMMAND ===>                                                                 
  100.                                                                                 
  101.    ISPF LIBRARY:                                                                
  102.       PROJECT ===> your userid                                                  
  103.       GROUP   ===> your initials     ===>           ===>         ===>           
  104.       TYPE    ===> FORTRAN                                                      
  105.       MEMBER  ===> program name    (Blank for member selection list)            
  106.                                                                                 
  107.    OTHER PARTITIONED OR SEQUENTIAL DATA SET:                                    
  108.       DATA SET NAME  ===>                                                       
  109.       VOLUME SERIAL  ===>          (If not catalogued)                          
  110.                                                                                 
  111.    DATA SET PASSWORD ===>          (If password protected)                      
  112.                                                                                 
  113.    PROFILE NAME      ===>          (Blank defaults to data set type)            
  114.                                                                                 
  115.           Hit return to access an empty file, and then enter your program.      
  116.           Use the TAB key to move from one line to the next.                    
  117.                                                                                 
  118.      1.4) To set the tab character, move the cursor on the quotes ('''''')      
  119.           of the first line.  Type over the quotes with the command COLS
  120.           and press return.  You will then be prompted with a second set
  121.           of quotes.  Type over these quotes with the command TABS,
  122.           and press return.  Move the cursor to column seven and type
  123.           an asterisk (*) in that column.  Type an asterisk (*) in
  124.           columns 10 and 12 as well.  This will enable you to better format
  125.           FORTRAN DO loops thus providing legibility.
  126.           Press return followed by the HOME key.  This will take your cursor
  127.           back to the COMMAND line.  Type the command RES which stands for
  128.           RESEQUENCE.  This will cause the rulers to disappear.  Now that
  129.           you have selected your TAB columns you may choose a TAB               
  130.           symbol to be used as the TAB key.  Before choosing a symbol, make
  131.           sure the character will not be used as part of the language.
  132.           In other words, since Fortran uses the period as part of              
  133.           its sentence structure you would not want to choose this as           
  134.           your TAB key.  One of the more popular symbols to choose is the
  135.           semicolon.  If you were to use the semicolon as your tab symbol,
  136.           you would type the following command on the command line:             
  137.                                                                                 
  138.          COMMAND==> TAB ON ;                                                    
  139.                                                                                 
  140.                                                                                 
  141.    EDIT --- User-id.Initials.FORT(member) ------------- COLUMNS 001 072         
  142.    COMMAND ===>                                        SCROLL ===>PAGE          
  143.    ****** ********************** TOP OF DATA ***************************        
  144.    =COLS>---1----+----2----+----3----+----4----+----5----+----6----+---         
  145.    =TABS>     *  * *                      *                                     
  146.    ''''''                                                                       
  147.    ****** *********************BOTTOM OF DATA **************************        
  148.                                                                                 
  149.           Type the word RESET at the prompt to reset the screen.                
  150. EJECT                                                                           
  151.      1.5) To enter your program, move the cursor to the first asterisk          
  152.           of the line below the "COMMAND ===>" prompt.  Here, type the          
  153.           letter "I" for insert and press return.  You will subsequently
  154.           be prompted for each line of data.  If no data is entered,
  155.           prompting will stop.
  156.           You may use the TAB key in order to move from one line to the         
  157.           other.  When you are ready to insert additional lines, simply
  158.           type the letter "I" on the line number for which inserted lines       
  159.           are to follow.  At this point you are ready to enter your program
  160.           or enter additional text.  You may use the semicolon any time
  161.           you wish to tab.  The first time you press the semicolon you
  162.           will start in column 7.  The second time the semicolon is pressed
  163.           you will start in column 10.  After typing your program you
  164.           should press the home key and type the word SAVE on the COMMAND       
  165.           line.  As a word of warning, any time you leave the EDIT screen,
  166.           option 2.0, your program is automatically saved.
  167.           Listed below is a sample FORTRAN program with the JCL necessary       
  168.           to compile, link and execute the program.                             
  169.                                                                                 
  170.                                                                                 
  171.                                                                                 
  172.                                                                                 
  173.    EDIT --- userid.initials.FORT(SELECT) - 01.00 ----- COLUMNS 001 072          
  174.    COMMAND ===>                                       SCROLL ===> PAGE          
  175.    ****** ********************** TOP OF DATA ******************************     
  176.    000100 //STEP1   EXEC  FORTVCLG                                              
  177.    000200        PROGRAM SELECT                                                 
  178.    000300        CHARACTER NAME*20, AGE*2, EMPNUM*5                             
  179.    000400        OPEN (UNIT = 7, FILE = 'OLDMAST', STATUS = 'OLD')              
  180.    000500        OPEN (UNIT = 8, FILE = 'NEWMAST', STATUS = 'OLD')              
  181.    000600 10     READ (7, 20, END = 900) NAME, AGE, EMPNUM                      
  182.    000700 20     FORMAT ( 3A )                                                  
  183.    000800 C                                                                     
  184.    000900 C      WRITE IF NAME STARTS WITH 'D' OR GREATER                       
  185.    001000 C                                                                     
  186.    001100        IF (NAME(1:1) .GT. 'C') WRITE (8, 20) NAME, AGE, EMPNUM        
  187.    001200 900    STOP                                                           
  188.    001300        END                                                            
  189.    001400 //GO.OLDMAST  DD    DSN=user-id.init.FORT(OLDMAST),DISP=SHR           
  190.    001500 //GO.NEWMAST  DD    DSN=user-id.init.FORT(NEWMAST),DISP=OLD           
  191.    ****** ********************* BOTTOM OF DATA ****************************     
  192.                                                                                 
  193.                                                                                 
  194.           All JCL starts with two slashes beginning in columns one and          
  195.           two.  The Dataset Definition referred to as the "DD" statement
  196.           is used to link the FORTRAN program to the data files on disk.
  197.           The DD names or the input and output files (lines 1400, and           
  198.           1500) contain the word GO followed by a period.  The name
  199.           following the "GO" is the internal link name referenced within        
  200.           the FORTRAN program.  These link names are the same ones used in
  201.           in the OPEN statements of you FORTRAN program.  If you forego
  202.           using the FORTRAN OPEN statement, the files are then linked           
  203.           using their unit device numbers.  If you were using a unit
  204.           device number of 20 for your write statement then your                
  205.           JCL link to device 20 would be FT20F001.                              
  206.           The Data Set Name otherwise referred to as the DSN is used to          
  207.           define the name of the data file residing on disk.  In
  208.           addition, the data set names used in the DSN parameter                
  209.           are shown to have a disposition (DISP) of OLD or SHR.  This
  210.           means the data sets must be previously allocated before the           
  211.           program can be executed.                                              
  212.                                                                                 
  213.      1.6) Hit the F4 key to go back to the PDF primary menu.  You do not        
  214.           need to save your program, because once you leave that screen,        
  215.           your program is automatically saved.                                  
  216.                                                                                 
  217.    SECTION TWO: Creating your data files.                                       
  218.                                                                                 
  219.      2.1) Type =3.2 at the "COMMAND ===>" prompt to go to the next panel.       
  220.           Use the TAB key to tab to the "TYPE ===>" prompt.  Enter the name     
  221.           of your input file.  Press the HOME key and enter "A" (for
  222.           allocation) and press return.  Another panel will be displayed
  223.           as the one shown below.  Use these same parameters as input
  224.           to your panel.
  225.                                                                                 
  226.    ------------------------ ALLOCATE NEW DATA SET -------------------------     
  227.    COMMAND ===>                                                                 
  228.                                                                                 
  229.    DATA SET NAME: User-id.Initial.Type                                          
  230.                                                                                 
  231.      VOLUME SERIAL   ===>          (Blank for authorized default volume)        
  232.      SPACE UNITS     ===>TRKS      (BLKS, TRKS or CYLS)                         
  233.      PRIMARY QUAN    ===>1         (in above units)                             
  234.      SECONDARY QUAN  ===>1         (in above units)                             
  235.      DIRECTORY BLOCKS===>0         (zero for sequential data set)               
  236.      RECORD FORMAT   ===>FB                                                     
  237.      RECORD LENGTH   ===>80   << The number of columns you expect  >>           
  238.      BLOCK SIZE      ===>80   << your input or output files to be  >>           
  239.                                You may block your records at one record         
  240.                                per block in which case the record size          
  241.                                will be the same as the block size.              
  242.                                                                                 
  243.                                                                                 
  244.           For the RECORD LENGTH and BLOCK SIZE sections, enter the same         
  245.           number you used in the RECORD CONTAINS clause of this file.           
  246.           Then hit return to go back to the DATA SET UTILITY panel.  Tab        
  247.           to the "TYPE ===>" prompt and enter the name of your output file.     
  248.                                                                                 
  249.      2.2) Create your output file the same way you created your input file.     
  250.                                                                                 
  251.      NOTE: The names of your input and output files have to be the same         
  252.            as the ones used in the DSN parameters of your FORTRAN program.      
  253.            If the are not, the JCL will give you an error message because       
  254.            the operating system will be looking for files that are not          
  255.            catalogued.                                                          
  256. EJECT                                                                           
  257.    SECTION THREE: Executing your FORTRAN program.                               
  258.                                                                                 
  259.      3.1) In order to execute your program you must be in the EDIT PANEL.       
  260.           Enter =2 at the "COMMAND ===>" prompt to go to the EDIT - ENTRY       
  261.           PANEL.  Type FORT at the "TYPE ===>" prompt followed by the           
  262.           name of your program at the "MEMBER ===>" prompt.  Then press         
  263.           return.                                                               
  264.                                                                                 
  265.      3.2) Type the command SUBT A,80 at the "COMMAND ===>" prompt               
  266.           of the panel where your program is displayed.  Then, press            
  267.           return to execute your program.  The "A" is the jobname
  268.           character that will be suffixed to your userid.  The batch
  269.           job is to use no more than 80 seconds of central processing           
  270.           time.                                                                 
  271.                        EXAMPLE:                                                 
  272.                                                                                 
  273.           COMMAND ===>SUBT A,80                                                 
  274.                                                                                 
  275.           Then, press return, and you will receive the message                  
  276.                                                                                 
  277.           IKJ56250I JOB useridA(JOBnumber) SUBMITTED                            
  278.           ***                                                                   
  279.           Remember the number inside parentheses.                               
  280.                                                                                 
  281.    SECTION FOUR: Accessing your job output.                                     
  282.                                                                                 
  283.      4.1) At the "COMMAND ===>" prompt, type =o.h to go to the SDSF or          
  284.           System Data Search Facility PANEL H option.                           
  285.                                                                                 
  286.                                                                                 
  287.    _____________________________________________________________________________
  288.    |SDSF HELD OUTPUT DISPLAY ALL CLASSES        406 LINES LINE 1-1 (1)          
  289.    |COMMAND INPUT ===>                                     SCROLL ===> HALF     
  290.    |NP JOBNAME  TYPE JNUM #DSNS CRDATE  C FCB  DEST     ROUTE #RECORDS RNUM  RD-
  291.    | S USERIDA   JOB 1139     5 8/15/91 X **** GSUMVS1             350 0275     
  292.    |____________________________________________________________________________
  293.                                                                                 
  294.        4.2) Tab to the field under the NP heading and type in the letter        
  295.             to view you job output.                                             
  296.                                                                                 
  297.                                                                                 
  298. EJECT                                                                           
  299.           Below is a copy of a successful FORTRAN execution as viewed from the  
  300.           SDSF menu option H.                                                   
  301.                                                                                 
  302.            BROWSE - USGHND.DAY.SPF235.OUTLIST ------------ LINE 000000 COL 001 0
  303.           COMMAND ===>                                            SCROLL ===>HAL
  304.           ********************************** TOP OF DATA ***********************
  305.           1                    J E S 2  J O B  L O G  --  S Y S T E M  G S U 1  
  306.                                                                                 
  307.    11.12.36 JOB 2185  ICH70001I USGHND   LAST ACCESS AT 11:09:25 ON TUESDA      
  308.    11.12.36 JOB 2185  $HASP373 USGHNDX  STARTED - INIT  A - CLASS A - SYS       
  309.    11.12.45 JOB 2185  -                                                --T      
  310.    11.12.45 JOB 2185  -JOBNAME  STEPNAME PROCSTEP    RC   EXCP   CONN    C      
  311.    11.12.45 JOB 2185  -USGHNDX  FORT                 00    332   1851    .      
  312.    11.12.45 JOB 2185  -USGHNDX  LKED                 00    332   1851    .      
  313.    11.12.45 JOB 2185  -USGHNDX  GO                   00    332   1851    .      
  314.    11.12.45 JOB 2185  -USGHNDX  ENDED.  NAME-USGHND  /\       TOTAL CPU TI      
  315.    11.12.46 JOB 2185  $HASP395 USGHNDX  ENDED        ||                         
  316.    0------ JES2 JOB STATISTICS ------                 ||                        
  317.    - 18 OCT 88 JOB EXECUTION DATE                     ||-------------------     
  318.    -         9 CARDS READ                             | A RETURN CODE (RC)      
  319.    -       152 SYSOUT PRINT RECORDS                   | OF ZERO MEANS YOUR      
  320.    -         0 SYSOUT PUNCH RECORDS                   | PROGRAM EXECUTED        
  321.    -         8 SYSOUT SPOOL KBYTES                    | WITHOUT ERRORS.         
  322.    -      0.17 MINUTES EXECUTION TIME                 |                         
  323.        1     //USGHNDX   JOB I994998,USGHND,          |--------------------     
  324.              //     NOTIFY=USGHND,CLASS=A,MSGLEVEL=(1,1),                       
  325.              //     USER=USGHND,TIME=(0,5)                                      
  326.                                                                                 
  327.                                                                                 
  328.      4.3) To print your output file, type O under the NP heading.  Your         
  329.           output     will normally be printed on one of the production          
  330.           laser printers located on the ground floor of the Library South       
  331.           building.  You can change the   destination by toggling to the        
  332.           field under the DEST header and overlaying the GSUMVS1                
  333.           destination.  For example, if you want your output printed on          
  334.           the high-speed printer located in LS109, overlay the GSUMVS1          
  335.           with TRM1.
  336.  
  337.           See the SDSF handout for further information.
  338.                                                                                 
  339. EJECT                                                                           
  340.    SECTION FIVE: Logging off.                                                   
  341.                                                                                 
  342.           To logoff, enter =X at the "COMMAND ===>" or "OPTION ===>"            
  343.           prompt of any panel.  Once the operating system displays the
  344.           message READY, you may then type the command LOGOFF.
  345.           At this point you will be disconnected from the system.
  346.                                                                                 
  347.                                                                                 
  348.    IMPORTANT NOTE:                                                              
  349.                                                                                 
  350.           The program file, and the input and output files that you have        
  351.           just created are saved in the system.  Therefore, subsequent          
  352.           executions should reference sections 3.1 through 4.4.                 
  353. EJECT                                                                           
  354.                                                                                 
  355.                     COMMONLY USED FEATURES OF THE FILE EDITOR                   
  356.                                     ISPF/PDF                                    
  357.                                                                                 
  358.       PROGRAM                                                                   
  359.    FUNCTION KEYS               NOTE: The more frequently used keys have         
  360.                                      been marked with an asterisk               
  361.      F1     HELP                                                                
  362.      F2     SPLIT SCREEN                                                        
  363.    * F3     END                                                                 
  364.      F4     RETURN                                                              
  365.      F5     RFIND                                                               
  366.      F6     RCHANGE                                                             
  367.    * F7     UP SCREEN                                                           
  368.    * F8     DOWN SCREEN                                                         
  369.      F9     SWAP                                                                
  370.    * F10    LEFT SCREEN                                                         
  371.    * F11    RIGHT SCREEN                                                        
  372.      F12    CURSOR                                                              
  373.                                                                                 
  374.    ------------------------------------------------------------------------     
  375.                                                                                 
  376.                                                                                 
  377.       ISPF/PDF                                                                  
  378.        MENUS                                                                    
  379.                                                                                 
  380.    * =2     EDIT                                                                
  381.      =3.1   DELETE MEMBERS                                                      
  382.      =3.2   DELETE DATA SETS                                                    
  383.      =3.4   GET LISTING OF ALL DATA SETS                                        
  384.      =3.6   GET PROGRAMS OF DATA FILES SENT TO PRINTER                          
  385.    * =3.8   DISPLAY OR PRINT JOB OUTPUT                                         
  386.                                                                                 
  387.    * =X     EXIT OR LOGOFF SYSTEM   (then type: logoff)                         
  388.                                                                                 
  389.                                                                                 
  390.    ------------------------------------------------------------------------     
  391.                                                                                 
  392.                       KEYBOARD NOTES                                            
  393.                                                                                 
  394.    *****      WHENEVER PROMPTED WITH '***' PRESS RETURN         *****           
  395.    *****      IF PROMPTED WITH "READY" TO GET BACK ON THE       *****           
  396.    *****      SYSTEM TYPE "ICF", OR IF YOU ARE FINISHED         *****           
  397.    *****      TYPE "LOGOFF".                                    *****           
  398.                                                                                 
  399.    *****      IF KEYBOARD FREEZES, PRESS THE TAB KEY            *****           
  400.    *****      IF STILL FROZEN, PRESS THE return key             *****           
  401.    *****      IF STILL FROZEN, PRESS CNTL G                     *****           
  402.    *****      IF KEYBOARD IS STILL LOCKED UP, PRESS ALT 2       *****           
  403.    *****      IF KEYBOARD IS STILL LOCKED UP, PRESS ALT 1       *****           
  404.                                                                                 
  405.    ------------------------------------------------------------------------     
  406.                                                                                 
  407.                                                                                 
  408.