30.0 SOURCE Command The SOURCE option allows the user to manage FORTRAN or C source decks and replace code depending on whether the code is to be run on one machine or the other. The program inputs code into core and does not change the original file. The program can be run in five modes using three distinct command structures: - Batch under B34S using the B34SEXEC SOURCE commands. - Interactively under B34S using the B34SEXEC SOURCE commands. - Interactively under B34S using menu driven commands. - Interactively running stand alone on MVS, CMS or IBM/PC using menu driven commands. - Batch under B34S using the native commands (see Old B34S manual. This manual documents the B34SEXEC SOURCE command and illustrates how interactive operation is performed under B34S. A listing of the options available is provided below. OPTION Description 1 Set unit number or unit name for input. 2 Set unit number or unit name for output. Default=6. 3 Remove active statements. 4 Add disabled statements. 5 Remove all C statements and save. 6 Remove all * statements and save. 7 Remove all * and C statements and save. 8 Save the code in core. 9 Display all subroutines, programs and functions found. 10 Display code in core at present. 11 Sort routines and display subroutine calling sequences. 12 Display subroutine information. 13 Extract a subroutine, function or program and save. 14 Obtain help. 15 Remove a routine from the active code. 16 Comment a routine. 17 Add a routine to the code. 18 Renumber all routines in col 73-80. 19 Override the SUBROUTINE/FUNCTION prefix. 20 Make all * comments C comments. 21 Display all codes in the program by SUBROUTINE. 22 Exit this program. Notes: Use options 7, 15, and 20 VERY carefully. Initially it is suggested that you output to the line printer to see what is bring done. The default prefix is C-****. The below listed code has IBM on and PC off. C-****PC * X=1 * Y=2 C-****PC C-****IBM X=10 Y=2 C-****IBM SUBROUTINE HEADERS, placed by option 16, are of the form C-****SUBHEADER name in col 50 at the beginning and the end of the routine. Discussion of B34SEXEC SOURCE commands. B34SEXEC SOURCE options parameters$ IN options $ OUT options $ REMOVE options $ SAVE $ DISPLAY options$ EXTRACT options$ COMMENTSUB options$ ADDSUB options$ RENUMBER $ SETSUBPRE options $ CSLINES $ EXIT $ The SOURCE command sentences are executed in turn. Hence there can be multiple sentences of the same name at different places. SOURCE sentence. The SOURCE sentence is used to call the B34S source manager program SOURCE. Unless the INTER option is used, the INFILE or INUNIT options are required. The EXIT sentence is required. SOURCE sentence options. HELP - Calls the SOURCE program help menu. BATCH - Runs SOURCE batch. This is the default. Batch means that B34SEXEC SOURCE command are used and menu prompting is not performed. INTER - Runs SOURCE in interactive form. User enters commands directly. PRINT - Turns on printing of intermediate steps as some commands run. INFILE(' ') - Supplies the infile name. Unless INUNIT is supplied, the in unit = 42. INUNIT(n1) - Supplies the infile unit. Unless INTER option is in effect, either INFILE or INUNIT is required. OUTFILE(' ') - Supplies the outfile name. The default is output to the line printer. If OUTFILE is supplied, the unit assumed is 43. OUTUNIT(n2) - Supplies the outfile unit. Note that either OUTFILE or OUTUNIT is required. Both cannot be used together, SOURCE sentence parameters. MAXSUB=n3 - Sets the maximum number of routines that can be loaded in core. On MVS B34S sets MAXSUM=800. The bigger MAXSUB, the less core available for code. IN sentence. The IN sentence is used to activate code that has been commented out and to optionally change the prefix. IN sentence options. NAMES(' ') - Sets names to act upon. If names do not begin with a character, use ' ' input form. PREFIX(' ') - Sets prefix. Default is C-****. Example of use of IN sentence. Assume the following code. C-****PC * X=1 C-****PC The Command IN NAMES('PC') PREFIX('C-****') $ will change all * comments to running statements inside the PC switch. The OUT sentence will reverse the process. If the user code file contains documentation inside the comments: C-DOC C documention here C-DOC The following commands will display the documention by routine. b34sexec source inunit(42) $ display codes prefix('C-DOC')$ exit $ b34seend$ Note: Once set, the PREFIX remains unless reset by OUT or IN sentence. OUT sentence. The OUT sentence is used to disable code that is now active. OUT sentence options. NAMES(' ') - Sets names to act upon. If names do not begin with a character, use ' ' input form. PREFIX(' ') - Sets prefix. Default is C-****. REMOVE sentence. The REMOVE sentence allows removing of * comments, C comments and complete routines. If should be used with caution. REMOVE sentence options. CLINES - Removes all C comment lines. SLINES - Removes all * comment lines. ROUTINES(' ',' ') - Removes completely indicated active subroutines, functions or programs. SAVE sentence. The SAVE sentence will save the active code in core in a file specified by OUTFILE or OUTUNIT in the SOURCE sentence. The form of the SAVE sentence is: SAVE $ DISPLAY sentence. The DISPLAY sentence allows display of code, subroutines found, arguments of subroutines and code in core. DISPLAY sentence options. SUBS - Will display all subroutines, function and programs found. CODE - Will display the core currently in core. SSUBS - Will sort subroutines and display calling sequences. SUBINFO - Will display subroutine calling sequences in order found. CODES - Will display all codes and marked code by subroutine name. DISPLAY sentence parameters. PREFIX(' ') - Sets prefix. Default is C-****. The following example illustrates how the DISPLAY sentence can be used to display calling esquences and routine documentation. Assume that all argument documentation is displayed between the codes C-DOC as listed below. C-DOC C documention here C-DOC The following commands will display the documention by routine. Calling sequences will also be shown. B34SEXEC SOURCE INUNIT(42) $ DISPLAY CODES PREFIX('C-DOC')$ EXIT $ B34SEEND$ Note: Once set, the PREFIX remains unless reset by OUT or IN sentence. EXTRACT sentence. The EXTRACT sentence is used to remove code from a file to save in OUTFILE. EXTRACT sentence options. ROUTINE(' ',' ') - Specifies the routines to extract. COMMENTSUB sentence. The COMMENTSUB sentence will mark active subroutines, functions or programs prior to turning them off. Subroutines that have been turned off can be reactivated by ADDSUB sentence which is documented below. If the subroutine or function already has a header card, the subroutine will just be commented out. COMMENTSUB sentence options. ROUTINE(' ',' ') - Specifies the routines to comment. ADDSUB sentence. The ADDSUB sentence will find commented subroutines or functions and turn them on. ADDSUB will turn on all statements. As a consequence it is important that the IN and OUT sentences be used to define the subroutine before production code. The DISPLAY CODES$ command can be used to tell if the activated subroutines contain sections that have been inadvertantently turned on. ADDSUB sentence options. ROUTINE(' ',' ') - Specifies the routines to add. RENUMBER sentence. The RENUMBER sentence will renumber code in core in col 73- 80. The form of the renumber sentence is: RENUMBER $ SETSUBPRE sentence. The SETSUBPRE sentence allows the user to override the default subroutine marking prefix of C-****SUBHEADER. For additional detail on the sentence marking card, see the B34S native command manual. SETSUBPRE sentence options. PREFIX(' ') - Specify the new prefix in ' '. CSLINES sentence. The CSLINES sentence will change all * comments to C comments. This is usally done once. If this command is given and there are code switches in the deck, these will be ruined since the code switch needs * comments to C comments. The form of the CSLINES sentence is: CSLINES $ EXIT sentence. The EXIT sentence is required to terminate SOURCE running. The form of the EXIT sentence is: EXIT $ Sample Job to run under B34S and activate all IBMMVS statements and disable all PC statements. Original file is BEC4346.OLD.FORT and the new file is BEC4346.NEW.FORT. The deck is numbered and a table is made of all subroutines argument lists. Finally a list is made of all IN and OUT lines in the program. b34sexec source infile('old.fort') outfile('new.fort') batch$ in names(ibmmvs) $ out names(ibmpc) $ renumber$ display subinfo$ display codes$ exit$ b34seend$ The following example will activate the routine TEST and comment out the routines LCOPY and ICOPY. Unit input is used. b34sexec source inunit(46) outunit(47) $ display ssubs $ commentsub routine(lcopy,icopy)$ addsub routine(test)$ display ssubs$ exit$ b34seend$ If B34SEEND is replaced with B34SRUN, the program will execute at once. The below listed example will extract the routine HRGR01 from FORTRAN in file TEST.FOR and will save the routine in the file JUNK.FOR. This command DOES not remove the routine from TEST.FOR. The command does not close the output file except when the B34S program ends. To make it possible to view the JUNK.FOR file from the B34S Display Manager, the file has been closed with the OPTIONS command. Note the the default unit 43 has been used to access the file 'JUNK.FOR' . b34sexec source infile('d:\b34sfort\test.for') outfile('junk.for') $ extract routine(hrgr01)$ exit$ b34srun$ b34sexec options close(43)$ b34srun$ The following will call SOURCE to run interactively under menu control under B34S. b34sexec source inter $ b34srun$ On a PC or CMS, SOURCE will call the SOURCE program to run interactively under menu control. Operating system specific notes: - Under PC specify infile and outfile as a DOS name only. - Under MVS use form /DSN[(MEMBER)] - Under CMS use form /FILENAME FILETYPE[FILEMODE])[(MEMBER)] - MVS and CMS use also allows specification of unit numbers provided that the units have been pre allocated. Unit defaults are CYL,(5,3), RECFM=FB and BLKSIZE=3600 where unit=42 is input and unit=43 is output. If this is not desired, the unit number input option will have to be used.