CAINDXProgramming Practices 00010003 C*********************************************************************** C COPYRIGHT ATLANTIC RICHFIELD COMPANY 1991 * C*********************************************************************** CTITLEEDP Program Standards 00020003 CA I. A source manager should be used to provide security yet ready 00030003 CA access to source code. Currently, all source, listings, and 00040003 CA load libraries are maintained on the IBM system and are 00050003 CA protected by RACF. Access for updating production modules is 00060003 CA controlled by using the Updates Management System (UMS) which 00070003 CA maintains a Model 204 data base of all updates. Programming 00080003 CA supervisors are the only ones authorized to make updates to 00090003 CA the production libraries. 00100003 CA 00110003 CA 00120003 CA II. Program Design 00130003 CA 00140003 CA A. All development projects should have a formal design 00150003 CA procedure. 00160003 CA 00170003 CA B. Top-down design should be used. 00180003 CA 00190003 CA C. Project leaders should provide a high level design 00200006 CA specification to the project programmer(s). Sub- 00210003 CA sequently the project programmer will submit a detailed 00220003 CA design to the project leader for review before any coding 00230006 CA begins. 00240006 CA 00250003 CA 00260003 CA III. Documentation of the Source Code. 00270003 CA 00280003 CA A. Provide a program header specifying program name, author, 00290003 CA computer system, and clear description of function. 00300003 CA 00310003 CA 1. If the subroutine is a single source but is used on 00320006 CA both the IBM and CRAY then the SYSTEM in the abstract 00330006 CA should specify "IBM AND CRAY". 00340006 CA 2. If the subroutine is only on one system then just that 00350006 CA system should be listed in the abstract. 00360006 CA 3. If the subroutine is on both the IBM and the CRAY but 00370006 CA the source code is different, then the abstract should 00380006 CA state "IBM (SEE CRAY)" or "CRAY (SEE IBM)". 00390006 CA 00400006 CA B. Sufficient documentation should be provided within the 00410003 CA source code to make the top-down design evident and the 00420003 CA function of the program obvious. 00430003 CA 00440003 CA C. Data formats which are new to the department should be 00450003 CA documented in detail within the program. Familiar and 00460003 CA previously defined data formats, such as ARCY, should be 00470003 CA noted as being part of the program's data requirements. 00480003 CA EJECT 00490003 CA 00500003 CA IV. User and Technical Documentation 00510003 CA 00520003 CA A. User documentation should be included as a member of the 00530003 CA same file structure used to maintain the program source. 00540003 CA The presence of this documentation will allow for 00550003 CA computerized user's guides. 00560003 CA 00570003 CA B. Technical documentaion should be provided for those 00580003 CA programs which require additional documentation to aid 00590003 CA in their use by the user community. This documentation 00600003 CA will be maintained separately to allow for use of 00610006 CA mathematical symbols and equations. 00620006 CA 00630003 CA 00640003 CA V. Coding and Testing 00650003 CA 00660003 CA A. Use top-down coding techniques. 00670003 CA 00680003 CA B. Variable names should not exceed eight characters. 00690010 CA 00700010 CA C. Because of IBM PDS member names, subroutine names should 00710010 CA not exceed seven characters. 00720010 CA 00730010 CA D. Minimize GO TO statements. 00740010 CA 00750003 CA E. Indent nested DO statements. 00760010 CA 00770003 CA F. Statements within the THEN or ELSE parts of a Fortran IF 00780010 CA statement should be indented. 00790003 CA 00800003 CA G. Test the program after each new level of the design is 00810010 CA implemented. 00820003 CAEND 00830003 CTITLEPrefixes -- Naming Conventions for Programs 00840003 CA Prefix Program Group or Type Examples 00850003 CA ------ ------- ----- -- ---- -------- 00860003 CA 00870003 CA A..... array operation ARMVE 00880003 CA 00890003 CA CP.... preparation control subroutine CPSMRY 00900003 CA 00910003 CA CS.... processing control subroutine CSACCT 00920003 CA 00930003 CA FJ.... Foreground JOBGEN routines; now used by FJPTAB 00940003 CA interactive SPARC control programs 00950003 CA 00960003 CA FO.... file operation, input-output FOACCT 00970003 CA 00980003 CA I..... interactive system routine IPVELP 00990003 CA 01000003 CA J..... job generator JSSPAC 01010003 CA 01020003 CA M..... mathematical operation, general use MASOLV 01030003 CA 01040003 CA SA.... seismic application subroutine, called SAEQUL 01050003 CA by one or two SD.... drivers. If the 01060003 CA subroutine is or can be called by more 01070003 CA than two drivers, it probably should be 01080003 CA a mathematical subroutine M..... or a 01090003 CA general utility subroutine US.... . 01100003 CA SA.... programs do not use common. 01110003 CA 01120003 CA SD.... seismic process driver. Controls traces SDFLTR 01130003 CA and processing parameters. Processes trace, 01140003 CA usually by call to SA.... program. 01150003 CA 01160003 CA SP.... seismic preparation program. Analyzes SPFLTR 01170003 CA data cards and creates seisparm parameter 01180003 CA records for use by process driver. 01190003 CA 01200003 CA UP.... utility subroutine which uses COMMON P. UPNPLT 01210003 CA Common usage is in dynamic allocation 01220003 CA programs. 01230003 CA 01240003 CA US.... utility subroutine, general use. USRHDR 01250003 CA US.... programs do not use common. A 01260003 CA special program used in only one or two 01270003 CA places probably should be named sa.... . 01280003 CA 01290003 CA UT.... utility program, stand alone. UTLCA 01300003 CAEND 01310003 CTITLEPreparation Routines 01320003 CA 01330003 CA The purpose of a preparation routine is to read the data cards 01340003 CA and form parameter records for use by the processor. Preparation 01350003 CA routine names begin with the characters SP. Preparation routines 01360003 CA do not have parameters in the calling sequence. 01370003 CA 01380003 CA A word on user documentation is appropriate at this time. Since 01390003 CA the preparation routines read the input seismic data cards, it is 01400003 CA logical to put the data card descriptions in them. The format for 01410011 CA specifying the data card layout is shown in Figure 6. All cards 01420013 CA beginning with 'CU ' in columns 1 to 3 will be listed. The very 01430003 CA first such card should contain the process name and description. 01440003 CA Between data card formats, a 'CU' card with 'EJECT' in columns 7 to01450003 CA 11 should be inserted to start the listing on a new page. This 01460003 CA card should not follow the last data card description. The reader 01470003 CA is referred to existing programs for examples. 01480003 CA 01490003 CA Along with initialization of variables, each preparation routine 01500003 CA should print a page heading using the subroutine USPHD. This page 01510003 CA heading identifies the process by name and process number, and 01520003 CA includes the date, time, and job name. 01530003 CA 01540003 CA To read the data cards, preparation routines use entry point FORC 01550003 CA of the input/output subroutine FOIP. To read and write parameter 01560003 CA records, entry points FORP and FOWP are used. If it is necessary 01570005 CA to force a default value on a data card, to get it in the 01580005 CA processing history, entry point FOWC may be used to re-write the 01590005 CA the data card to the SEISPARM file. 01600005 CA 01610005 CA All preparation routines write the same type of parameter records. 01620003 CA The parameter records are built in an array named DENTRY. The 01630003 CA first eight words of DENTRY are the same for all records, although 01640003 CA every preparation routine may not use all eight words. These eight01650003 CA words are: 01660003 CA 01670003 CA 1. process name (KPNA) 01680003 CA 2. process number (KPRNO) 01690003 CA 3. keyword for type of record (characters) 01700003 CA 4. starting shotpoint/depth point number 01710003 CA 5. ending shotpoint/depth point number 01720003 CA 6. number of parameters in record (not including first 01730003 CA eight words) 01740003 CA 7. byte 1 - type of interpolation 01750003 CA N - no interpolation 01760003 CA L - linear interpolation 01770003 CA byte 2 - processing mode (S, D, or F) 01780003 CA bytes 3-4 - not used 01790003 CA 8. shotpoint location (from USSLN) or depth point 01800003 CA 01810003 CA The remaining words are then used to pass any necessary parameters 01820003 CA to the processor. DENTRY may be dimensioned up to 104. This is 01830003 CA the suggested dimension since the input/output routines always use 01840003 CA records that contain 104 words. Word seven, containing the 01850003 CA interpolation type and processing mode, is set during initiali- 01860003 CA zation and then remains set for all parameter records. 01870003 CA EJECT 01880003 CA 01890003 CA 01900003 CA 01910003 CA8080 01920003 CU PROCESS SUBN -- NAME AND DESCRIPTION OF PROCESS 01930003 CU DATA CARD (1) -- DEFINES S OR D RANGE AND OTHER PARAMETERS 01940003 CU 01950003 CU NO. OF CARDS: REQUIRED = 1 ALLOWED = NO LIMIT 01960003 CU 01970003 CU REQ OR OPT 01980003 CU DF COLS DESCRIPTION OR DEFAULT 01990003 CU -- ----- ----------- ----------- 02000003 CU 1 1- 4 'SUBN' | REQ | 02010003 CU 2 - 5 PROCESS NUMBER | 0 | 02020003 CU 3 - 6 TYPE OF INTERPOLATION |LINE CARD| 02030003 CU 'L' = LINEAR | | 02040003 CU 'N' = NO INTERPOLATION | | 02050003 CU 4 - 7 PROCESSING MODE |LINE CARD| 02060003 CU 'S' = SHOTPOINT MODE | | 02070003 CU 'D' = DEPTH POINT MODE | | 02080003 CU 5 8-10 FOR PROGRAMMING USE | | 02090003 CU 6 11-15 BEGINNING SHOTPOINT OR DEPTH POINT | REQ | 02100003 CU 7 16-20 ENDING SHOTPOINT OR DEPTH POINT | DF6 | 02110003 CU 8 21-25 ........... | OPT | 02120003 CU 9 26-30 ........... | | 02130003 CU 10 31-35 ........... |NOTE DF10| 02140003 CU 11 36-40 ........... | | 02150003 CU 12 41-45 ........... | | 02160003 CU 13 46-50 ........... | | 02170003 CU 14 51-55 ........... | | 02180003 CU 15 56-60 ........... | | 02190003 CU 16 61-65 ........... | | 02200003 CU 17 66-70 ........... | | 02210003 CU 18 71-75 ........... | | 02220003 CU 19 76-80 ........... | | 02230003 CU ----------- 02240003 CU 02250003 CU DF NOTES 02260003 CU -- ----- 02270003 CU 6 WHEN MORE THAN ONE CARD IS INCLUDED, THE PROCESSING MODE 02280003 CU RANGES ON DIFFERENT CARDS CANNOT OVERLAP. 02290003 CU 10 DESCRIPTION OF DATA FIELD 10. 02300003 CU EJECT 02310003 02320003 02330003 02340003 Format for User's Notes 02350003 Figure 6, page 1 of 2 02360013 CA8080 02370003 CA EJECT 02380003 CA 02390003 CA 02400003 CA 02410003 CA8080 02420003 CU DATA CARD (2) -- DESCRIPTION OF DATA CARD 2 02430003 CU 02440003 CU NO. OF CARDS: REQUIRED = 1 ALLOWED = NO LIMIT 02450003 CU 02460003 CU REQ OR OPT 02470003 CU DF COLS DESCRIPTION OR DEFAULT 02480003 CU -- ----- ----------- ----------- 02490003 CU 1 1- 4 'SUBN' | REQ | 02500003 CU 2 - 5 PROCESS NUMBER | 0 | 02510003 CU 3 - 6 NOT USED | | 02520003 CU 4 - 7 NOT USED | | 02530003 CU 5 8-10 CARD IDENTIFICATION CODE (ALPHANUMERIC) | REQ | 02540003 CU 6 11-15 ......... | | 02550003 CU 7 16-20 ......... | | 02560003 CU 8 21-25 ......... | | 02570003 CU 9 26-30 ......... | | 02580003 CU . . | | 02590003 CU . . | | 02600003 CU . . | | 02610003 CU 19 76-80 ......... | | 02620003 CU ----------- 02630003 CU 02640003 CU DF NOTES 02650003 CU -- ----- 02660003 CU DESCRIPTIONS NECESSARY FOR ANY FIELDS. 02670003 CU 02680003 02690003 02700003 02710003 Format for User's Notes 02720003 Figure 6, page 2 of 2 02730013 CA8080 02740003 CA EJECT 02750003 CA There is one type of parameter record that is written first by all 02760003 CA preparation routines. This record contains a list of processing 02770003 CA ranges for the process. The keyword (word three of DENTRY) 02780003 CA normally used to denote this type of record is 'PTS '. The data 02790003 CA entries, starting in word nine, are pairs of beginning and ending 02800003 CA shotpoints/depth points. The ending shotpoint/depth point may be 02810003 CA equal to the starting one. When necessary, more than one parameter02820003 CA record may be written with the keyword 'PTS '. Preparing these 02830003 CA records means that an initial pass must be made through the data 02840003 CA cards. Figure 7 illustrates the layout of this record. 02850013 CA 02860003 CA All other parameter records follow the records which give the 02870003 CA processing ranges. Except for the first eight words, they can be 02880003 CA tailored to the individual process. More than one keyword may be 02890003 CA used, if desired. 02900003 CA 02910003 CA Generally, because of interpolation, two records will be written 02920003 CA for each set of parameters. The first record will have the 02930003 CA starting shotpoint/depth point for the parameters and the second 02940003 CA record will have the ending shotpoint/depth point even if it is the02950003 CA same as the starting point. This arrangement makes possible an 02960003 CA ingenious interpolation scheme which is described later. Processes02970003 CA such as EDIT, to which interpolation is not applicable, may write 02980003 CA only one record for each set of parameters. Figure 8 shows one of 02990013 CA the formats for the VSUM process. 03000004 CA 03010003 CA Before exiting, the preparation routine should be set up to dump 03020004 CA the parameter records if the debug flag, KPBUGF, is on (greater 03030003 CA than 0). This debug print and any other printout should be on unit03040003 CA KPPRNT. 03050003 CA EJECT 03060003 CA 03070003 CA WORD 1 WORD 2 WORD 3 WORD 4 WORD 5 WORD 6 WORD 7 WORD 8 03080003 CA |_______|________|_______|_______|_______|_______|_|_|_____|_______| 03090003 CA | PROC | INVOC. | PTS | NOT | NOT | # OF |N|P| NOT | NOT | 03100003 CA |_______|_NUMBER_|_______|__USED_|__USED_|_PARMS_|_|M|_USED|__USED_| 03110003 CA 03120003 CA WORD 9 WORD 10 03130003 CA |_______|________| 03140003 CA | START | END | 03150003 CA |SHOT_PT|_SHOT_PT| 03160003 CA . . . 03170003 CA . . . 03180003 CA . . . 03190003 CA WORD 103WORD 104 03200003 CA |_______|________| 03210003 CA | START | END | 03220003 CA |SHOT_PT|_SHOT_PT| 03230003 CA 03240003 CA 03250003 CA Format of Parameter Record for Processing Ranges 03260003 CA Figure 7 03270013 CA 03280003 CA 03290003 CA 03300003 CA 03310003 CA 03320003 CA 03330003 CA ****** TRC OR DIS RECORD ****** SELECTION PARAMETERS ****** 03340003 CA 03350003 CA WORD 1 WORD 2 WORD 3 WORD 4 WORD 5 WORD 6 WORD 7 WORD 8 03360003 CA |_______|________|_______|_______|_______|_______|_|_|_____|_______| 03370003 CA | VSUM | INVOC. |'DIS'OR| START | END | # OF |N|P|TOL. | SHOT | 03380003 CA |_______|_NUMBER_|_'TRC'_|S/D PT.|S/D PT.|_PARMS_|_|M|DIST.|_LOCN._| 03390003 CA 03400003 CA WORD 9 WORD 10 WORD 11 WORD 12 03410003 CA |_______|________|_______|_______________| WORD 9 (NO. PTS. TO SUM) 03420003 CA |NO. PTS|INC OF |INC STR|RESEQ. |RESEQ. | IS FLAGGED NEGATIVE TO 03430003 CA |TO SUM |SUM_____|OF SUM_|FILE NO|INCR.__| INDICATE AN X-DISTANCE 03440003 CA SUMMATION. 03450003 CA WORD 13 WORD 14 ..... WORD 104 03460003 CA |_______|________| ..... |_______| (-T(N) INDICATES OPERATE ON 03470003 CA |T(1) OR|T(2) OR | ..... |T(N) OR| TRACES T(N-1) THRU T(N)) 03480003 CA |DIS(1)_|DIS(2)__| ..... |DIS(N)_| 03490003 CA 03500003 CA 03510003 CA Format of a Parameter Record for the VSUM Process 03520003 CA Figure 8 03530013 CAEND 03540003 CTITLEProcessors 03550003 CA 03560003 CA The processors determine which traces are to be processed and the 03570003 CA functions to be performed upon them. Processor names begin with 03580003 CA the characters SD. Each processor has four input parameters: 03590003 CA input trace header, input trace, output trace header, and output 03600003 CA trace. Thus a Fortran call to a process named PROC is 03610004 CA 03620003 CA CALL SDPROC (INH, INTR, OH, OTR) 03630003 CA 03640003 CA These variables are used in all processors with INH and OH declared03650003 CA as integer arrays and INTR and OTR declared as real arrays. 03660003 CA 03670003 CA Each processor is serially reusable. One copy of the program will 03680003 CA be loaded even though there may be several occurrences of the 03690003 CA process with the same or different parameters. 03700003 CA 03710003 CA Making the processor serially reusable is accomplished through use 03720003 CA of the KP-area with each occurrence saving all necessary values in 03730003 CA reserved blank common. Reserving space in blank common should only03740003 CA be done during initialization. Space in blank common, which is 03750003 CA allocated in the control program CSEXEC, is reserved by calling the03760011 CA subroutine UPRESM. This subroutine returns a Fortran index into 03770011 CA blank common for the reserved space and the number of words 03780011 CA reserved. These values are returned in KP-area variables KPIRSM 03790003 CA and KPNRSM, respectively. KPIUSM and KPNUSM are the index to, and 03800011 CA the number of words of unreserved space, respectively. Upon each 03810004 CA entry to a process, the control program will set KPIUSM and KPNUSM 03820004 CA so that the remaining scratch memory can be used for temporary 03830004 CA storage. The processors use an array, named DLOCAL, to contain 03840004 CA values and pointers to blank common for the parameters appropriate 03850004 CA to one particular occurrence of a process. DLOCAL is normally 03860004 CA dimensioned for 50 words, but may be more if necessary. The values03870004 CA for this array are always moved from blank common (using variable 03880004 CA KPIRSM) into the array upon entry to the program, and vice versa 03890004 CA upon exit. Some typical data elements in this array include a 03900004 CA pointer into blank common to the array containing the process 03910004 CA ranges, a pointer to a table of appropriate parameters, an array of03920004 CA shotpoints/depth points processed, etc. Everything that is 03930004 CA variable between different occurrences of a process should go into 03940004 CA DLOCAL or be in a reserved scratch memory area that is pointed to 03950004 CA by an entry in DLOCAL. 03960004 CA 03970003 CA In order to initialize variables and reserve scratch memory, the 03980003 CA KP-area contains a first call flag, KPFCF. This variable initially03990003 CA has a value of 1 and should be set to 0 the first time through. 04000003 CA Several tables are normally built in reserved scratch memory during04010003 CA initialization. A table containing beginning and ending 04020003 CA shotpoints/depth points is built from the 'PTS ' parameter records.04030003 CA A second table, called the disk address table, is also built which 04040003 CA consists of the disk address pointer (the parameter passed to FORP)04050003 CA for the first parameter record for each shotpoint location (word 8 04060003 CA of the parameter records). This table is sorted into 04070003 CA shotpoint/depth point location order. When processing in depth 04080003 CA point mode, word 8 of the parameter record is set to the depth 04090003 CA point number. In addition to these two tables, processor 04100003 CA initialization should set a processing mode flag, reserve scratch 04110003 CA memory for parameters and any other necessary data, and print a 04120003 CA page heading using USPHD. 04130003 CA 04140003 CA Spatial interpolation of parameters for undefined shotpoints/depth 04150003 CA points is handled in a unique way. One of the key factors is that 04160003 CA the preparation routine writes a parameter record for each starting04170003 CA point and each ending point which define the processing ranges. In04180003 CA addition, parameter records containing the ordered set of 04190003 CA processing ranges are also written. When interpolation is desired,04200003 CA the processing program increments through the ordered set of 04210003 CA processing ranges with an increment of one. This essentially does 04220003 CA away with the pairing characteristics of the processing ranges and 04230003 CA each entry is treated separately. The parameters that fall on 04240003 CA either side of an incoming shotpoint/depth point are used to obtain04250003 CA the interpolated values. If no interpolation is desired, the 04260003 CA processing program increments through the ordered set of processing04270003 CA ranges with an increment of two. This results in the processing of04280003 CA only those shotpoints/depth points defined in the processing 04290003 CA ranges. 04300003 CA 04310003 CA For output, each processor prints the shotpoint/depth point numbers04320003 CA that have been processed. These numbers are printed twenty-four to04330003 CA a line and are preceded by the total number that have been 04340003 CA processed. Three variables which are a part of DLOCAL are used for04350003 CA this purpose. PSHOT is an array of 24 elements that holds the 04360003 CA shotpoints/depth points. NS is the index to the last number in 04370003 CA PSHOT. TNS is the total count of shotpoints/depth points 04380003 CA processed. Naturally, a shotpoint/depth point is entered only once04390003 CA in PSHOT, not once for each trace processed. 04400003 CAEND 04410003 CTITLEPlotting Programs 04420003 CA 04430003 CA This section describes the code required to create a new SPARC 04440007 CA process that produces a plot data set, either color or graphic. 04450007 CA These procedures have been established to ensure that the new 04460007 CA process will properly interface with both SPARC control software 04470007 CA and EDP's plotting system and will aid in future maintenance of all04480007 CA software. Within SPARC, UNIRAS is used to produce the color plots 04490007 CA and the Logic Associates package (normal Calcomp calls to PLOT, 04500007 CA NUMBER, etc.) is used to produce graphic plots. The Logic 04510007 CA Associates package produces the output data set into the proper 04520007 CA format for EDP's plotting system and is not a general format for 04530007 CA any plotter. 04540007 CA 04550007 CA 04560008 CA Six steps or procedures are required. 04570007 CA 04580003 CA A1. Include the variables KPVOLS and KPDSNS in COMMON /P/. They 04590007 CA will point to regions of blank common which contain the volume 04600007 CA serial numbers and output data set numbers. Remember to run 04610008 CA the common generating program to insure proper addressing. 04620008 CA See next section for details on using these variables. 04630008 CA 04640003 CA A2. During preliminary operations (first call), reserve blank 04650007 CA common storage for the volume serial numbers and data set 04660007 CA numbers. 04670007 CA 04680007 CA Put the first word for the volume serial numbers on a 04690007 CA double-word boundary (index odd). If index of unreserved 04700007 CA common is odd, get 512 words. If index is even, get 513 words 04710007 CA and skip one word. Immediately after the area for the volume 04720007 CA serial numbers, allow enough memory to hold the output data set04730007 CA numbers. (A process may generate more than one output data 04740007 CA set.) The definitions of these two areas are: 04750007 CA 04760007 CA 04770007 CA COM(KPVOLS) = number of volume serial numbers in list. 04780007 CA COM(KPVOLS+1) = (not used) 04790007 CA COM(KPVOLS+2,3) = double-word used for serial number. 04800007 CA COM(KPVOLS+4,5...) = succeeding serial numbers. 04810007 CA 04820007 CA COM(KPDSNS) = number of data set numbers in the list. 04830007 CA COM(KPDSNS+1) = 0 until plot is added to plot queue. 04840007 CA = 1 when plot is added to the plot queue. 04850007 CA COM(KPDSNS+2,3) = 8 character bytes of the data set number. 04860007 CA The second part of the dsname, characters 04870007 CA 5 thru 12 may be copied here; i.e. it is 04880007 CA ok to copy the D or T from the dsname 04890007 CA because it will be ignored. 04900007 CA COM(KPDSNS+4,5...) = succeeding data set numbers. 04910007 CA EJECT 04920008 CA Appropriate code follows: 04930007 CA 04940007 CA KPVOLS = KPIUSM 04950000 CA IF ((KPVOLS/2)*2 .EQ. KPVOLS) KPVOLS = KPVOLS + 1 04960000 CA KPDSNS = KPVOLS + 512 04970007 CA IC = KPDSNS + nplots * 2 + 2 04980007 CA NOWDS = IC - KPIUSM 04990000 CA CALL UPRESM (NOWDS) 05000000 CA IF (NOWDS .EQ. 0) GO TO xxxx 05010000 CA 05020007 CA A3. Subroutine UPNPLT should be used to dynamically allocate the 05030008 CA output plot file. For color plots, UPNPLT should be called 05040008 CA immediately before calling the UNIRAS driver. For graphic 05050009 CA plots UPNPLT should be called immediately before the call to 05060009 CA PLOTS. After calling UPNPLT, the data set number should be 05070009 CA stored in the KPDSNS area. 05080011 CA 05090007 CA A4. After a graphic plot is completed, usually with 05100009 CA 05110003 CA CALL PLOT (0, 0, 999), 05120003 CA 05130003 CA or just before calling the UNIRAS driver, call subroutine 05140009 CA USDDNV which obtains the volume serial numbers given the DDNAME05150009 CA (obtained in call to UPNPLT). Appropriate code follows: 05160009 CA 05170003 CA CALL USDDNV (DDNAME, COM(KPVOLS + 2), COM(KPVOLS), IER) 05180003 CA GO TO (d, a, b, c), IER 05190003 CA NO DD-CARD PRESENT. 05200009 CA a WRITE (KPPRNT, 9a) DDNAME 05210003 CA GO TO d 05220003 CA NUMBER OF VOLUMES IN PLOT FILE IS ZERO. 05230003 CA b WRITE (KPPRNT, 9b) DDNAME 05240000 CA GO TO d 05250000 CA NUMBER OF VOLUMES IN PLOT FILE IS > 5 05260000 CA c WRITE (KPPRNT, 9c) DDNAME 05270000 CA GO TO d 05280003 CA d ... 05290003 CA 05300008 CA In the call to USDDNV, 05310008 CA 05320003 CA DDNAME = ddname of the output file, 05330003 CA COM (KPVOLS + 2) = start of list of reel numbers, 05340003 CA COM (KPVOLS) = number of reels, 05350003 CA IER = return code = 1, 2, 3, or 4. 05360003 CA 05370003 CA Print a message if the return code is 2, 3, or 4. 05380008 CA At this time USDDNV returns code 4 if there are more than five 05390008 CA reels. On the IBM, we do not now know how to obtain the reel 05400008 CA numbers if there are more than five. 05410008 CA 05420003 CA Include format statements for the messages. Examples follow: 05430008 CA 05440003 CA 9a FORMAT(5x, '*** NO DD-CARD PRESENT WITH DDNAME ', A8) 05450008 CA 05460003 CA 9b FORMAT(5x, '*** NO OUTPUT REELS FOR FILE WITH DDNAME ', A8) 05470008 CA 05480003 CA 9c FORMAT(5x, '*** MORE THAN 5 REELS FOR FILE WITH DDNAME ',A8)05490008 CA 05500003 CA A5. Use UGUNAL to unallocate the output data set. 05510008 CA 05520003 CA A6. After calling UGUNAL, use UPAPLT to add the output data set to 05530008 CA the plot queue and set the flag in the KPDSNS area. 05540008 CA 05550008 CA Note on color processes: cc 56-60 of the first data card should 05560008 CA contain a parameter for the number of output plots to be generated.05570008 CA This value will then be used by JOBGEN to generate enough output 05580008 CA data set names if the process is to be executed on the CRAY. The 05590008 CA parameter should have no affect on an IBM job. 05600008 CAEND 05610003 CTITLESingle Entry Subroutine Coding Conventions 05620003 CA 05630003 CA8080 05640003 7 05650003 CTITLESUBNAM -- FUNCTION OR PURPOSE OF THE SUBROUTINE............ 05660003 05670003 SEE SECTION ON SUBROUTINE NAMING CONVENTIONS 05680003 05690003 7 20 05700003 CA AUTHOR ............. 05710003 CA DESIGNER .................. 05720003 CA LANGUAGE FORTRAN, ASSEMBLER ETC. 05730006 CA SYSTEM IBM, CRAY, TI980 ETC. 05740006 CA WRITTEN MO-DA-YR 05750003 C REVISED MO-DA-YR BY PROGRAMMER FOR REASON. 05760003 C REVISED 05770003 CA 05780003 7 05790003 CA CALL SUBNAM (A, M, B, N, ...) 05800003 CA 05810003 CA IN/OUT ARGUMENT TYPE DESCRIPTION 05820003 CA 05830003 CA IN A R4 DEFINITION OF PARAMETER A 05840003 CA IN M I4 ......................... 05850003 CA OUT B R4 ......................... 05860003 CA OUT N I4 ......................... 05870003 CA . . . 05880003 05890003 IN GENERAL, PLACE INPUT PARAMETERS BEFORE OUTPUT PARAMETERS. 05900003 05910003 PLACE ERROR RETURNS AT OR NEAR THE END OF THE PARAMETER LIST. 05920003 05930003 05940003 ABSTRACT DOCUMENTATION 05950003 CA 05960003 CA CARDS WITH CA (*A FOR ASSEMBLER) IN COLUMNS 1 AND 2 05970003 CA WILL BE USED TO PRODUCE AN ABSTRACT. 05980003 CA 05990003 CA BRIEF DESCRIPTION OF THE PROGRAM -- FUNCTION, PURPOSE, ETC. 06000003 CA 06010003 C EJECT 06020003 SUBROUTINE SUBNAM (A, M, B, N, ...) 06030003 C 06040003 IMPLICIT INTEGER (A-Z) 06050003 C 7 20 06060003 COMMON COM ( 1) 06070003 C 06080003 7 20 06090003 COMMON /P/ STARTP 06100003 COMMON /P/ ...... 06110003 COMMON /P/ ...... 06120003 COMMON /P/ ...... 06130003 COMMON /P/ ENDP 06140003 06150003 06160003 THE FOLLOWING LISTS OF VARIABLES ARE INTENDED TO SHOW ONE WAY OF 06170003 ARRANGING THE DIMENSION AND TYPE STATEMENTS. THE BASIC IDEA IS 06180003 TO MAKE THESE STATEMENTS NEAT AND EASY TO READ. THE FOLLOWING 06190003 FEATURES ARE HELPFUL. 06200003 06210003 ONE VARIABLE PER CARD. 06220003 06230003 VARIABLE NAME STARTS IN A GIVEN COLUMN. COLUMN 20 IS GOOD 06240003 BECAUSE IT LEAVES ROOM FOR THE LONGEST TYPE, COMPLEX *16, OR 06250003 FOR THE WORD "EQUIVALENCE." 06260003 06270003 DIMENSIONS ARE RIGHT-ADJUSTED TO A GIVEN COLUMN. 06280003 06290003 EQUIVALENCE BETWEEN A SCALAR AND AN ARRAY ELEMENT IS DECLARED06300003 AT THE END OF THE LIST CONTAINING THE ARRAY. 06310003 06320003 IF THE LISTS ARE SHORT, IT MAY BE NEATER TO COMBINE SEVERAL 06330003 TYPES IN ONE LIST (REAL, INTEGER, AND COMPLEX, FOR EXAMPLE). 06340003 IT IS USUALLY BETTER, HOWEVER, TO KEEP ARRAYS AND SCALARS IN 06350003 SEPARATE LISTS. 06360003 C EJECT 06370003 C 06380003 C 06390003 C REAL ARRAYS IN PARAMETER LIST. 06400003 REAL A (1) 06410003 REAL *8 B (1) 06420003 C 06430003 C 06440003 C INTEGER ARRAYS IN PARAMETER LIST. 06450003 INTEGER *2 M (1) 06460003 INTEGER N (1) 06470003 C 06480003 C 06490003 C NOTE: ROUTINES TO BE EXECUTED ON THE CRAY WILL HAVE TO USE DATA 06500012 C STATEMENTS TO INITIALIZE VARIABLES. 06510012 C 06520012 C REAL ARRAYS--LOCAL (INTERNAL TO SUBROUTINE). 06530003 REAL C ( 10) / 10 * 0.0 / 06540003 REAL *8 DANDT ( 2) / 2 * ' ' / 06550003 REAL ZETA ( 250) / 250 * 0.0 / 06560003 C 06570003 EQUIVALENCE (DANDT ( 1), DATE) 06580003 EQUIVALENCE (DANDT ( 2), TIME) 06590003 C 06600003 EQUIVALENCE (ZETA ( 2), ZETALN) 06610003 EQUIVALENCE (ZETA ( 249), ZETAM ) 06620003 C 06630003 C 06640003 C INTEGER ARRAYS--LOCAL (INTERNAL TO SUBROUTINE). 06650003 INTEGER CHAR ( 256) / 256 * 0 / 06660003 INTEGER *2 NTEMPO (5000) / 5000 * 0 / 06670003 C 06680003 EQUIVALENCE (CHAR ( 251), VORBAR) 06690003 EQUIVALENCE (NTEMPO ( 1), MONTH ) 06700003 C 06710003 C 06720003 C REAL VARIABLES AND CONSTANTS--LOCAL (INTERNAL TO SUBROUTINE). 06730003 REAL *8 DATE 06740003 REAL E / 0.001 / 06750003 REAL FIFO / 0.0 / 06760003 REAL FINAL / 10000.0 / 06770003 REAL *8 FIPHI / 0.0 / 06780003 REAL GINCR / 0.1 / 06790003 REAL PI / 3.1415927 / 06800003 REAL *8 TIME 06810003 REAL UPPERL / 1.0 E50 / 06820003 REAL X / 0.0 / 06830003 REAL *8 XX / 0.0 / 06840003 REAL ZETALN 06850003 REAL ZETAM 06860003 C 06870003 C 06880003 C INTEGER VARIABLES AND CONSTANTS--LOCAL (INTERNAL TO SUBROUTINE). 06890003 INTEGER *2 IMAX / 5000 / 06900003 INTEGER MAXMAX / 99999 / 06910003 INTEGER *2 MONTH 06920003 INTEGER *2 NINDEX / 0 / 06930003 C EJECT 06940003 C 06950003 C 06960003 C 06970003 CHOICE OF STATEMENT NUMBER RANGES. 06980003 06990003 PRELIMINARY OPERATIONS 10 - 900 07000003 07010003 MAIN OPERATIONS 1000 - 8000 07020003 07030003 FORMAT STATEMENTS 9000 - 9900 07040003 07050003 07060003 C PRELIMINARY OPERATIONS. 07070003 C 07080003 10 ... 07090003 ... 07100003 200 ... 07110003 C 07120003 C 07130003 C MAIN OPERATIONS, SECTION 1. COMPUTE ... . 07140003 1000 ... 07150003 ... 07160003 1160 ... 07170003 C 07180003 C MAIN OPERATIONS, SECTION 2. COMPUTE ... . 07190003 1200 ... 07200003 ... 07210003 1260 ... 07220003 C 07230003 C 07240003 ... 07250003 ... 07260003 ... 07270003 C 07280003 C 07290003 C FINAL OPERATIONS. 07300003 1800 ... 07310003 ... 07320003 1830 ... 07330003 C 07340003 C 07350003 9000 FORMAT(...) 07360003 9010 FORMAT(...) 07370003 07380003 C EJECT 07390003 07400003 GENERAL RULES FOR CODING STATEMENT NUMBERS. 07410003 07420003 USE ASCENDING NUMBERS AS THE SOURCE CODE PROGRESSES 07430003 FROM THE TOP. 07440003 07450003 IN GENERAL, USE AN INCREMENT OF 10. 07460003 07470003 AT EACH LOGICAL PROGRAM BREAK GO TO THE NEXT 07480003 MULTIPLE OF 100. 07490003 07500003 RIGHT ADJUST TO COLUMN 5 IN THE LABEL AREA 07510003 (COLUMNS 1 TO 5). 07520003 07530003 RIGHT ADJUST TO COLUMN 70 IN THE STATEMENT AREA 07540003 (COLUMNS 7 TO 72). 07550003 07560003 EXAMPLES OF ADJUSTMENT TO COLUMN 70. 07570003 07580003 GO TO 1000 07590003 07600003 IF (N .NE. 0) GO TO 1000 07610003 07620003 IF (N) 1000, 2000, 3000 07630003 07640003 GO TO (1000, 2000), IBR 07650003 07660003 GO TO SUBRTN, (1000, 2000) 07670003 07680003 07690003 07700003 DO LOOPS STATEMENTS BEGIN IN COLUMN 9. 07710003 NESTED LOOPS BEGIN IN COLUMN 9, 11, 13, ETC. 07720003 07730003 9 07740003 DO 510 I = 1, N 07750003 ....... 07760006 ....... 07770006 DO 500 J = 1, M 07780003 ....... 07790003 ....... 07800003 ....... 07810003 500 CONTINUE 07820003 ....... 07830006 510 CONTINUE 07840003 07850006 07860006 07870006 IF-THEN-ELSE STATEMENTS: 07880006 NESTED IFS SHOULD BE INDENTED 2 COLUMNS FOR EACH NESTING 07890006 LONG SEQUENCES OF NESTED IFS IS DISCOURAGED. 07900006 07910006 7 07920006 IF (...) THEN 07930006 ....... 07940006 ....... 07950006 ELSE 07960006 ....... 07970006 IF (...) THEN 07980006 ....... 07990006 END IF 08000006 ....... 08010006 END IF 08020006 C 08030003 C 08040003 C 08050003 C EJECT 08060003 USE THE ASSIGNED GO TO ONLY AS A DEVICE FOR MAKING AN INTERNAL 08070003 SUBROUTINE. 08080003 08090003 08100003 C CALL INTERNAL SUBROUTINE ISXXXX. 08110003 ASSIGN 1000 TO IRXXXX 08120003 GO TO 5000 08130003 1000 CONTINUE 08140003 . 08150003 . 08160003 . 08170003 C INTERNAL SUBROUTINE ISXXXX. 08180003 C CALCULATION OF ........................... 08190003 5000 CONTINUE 08200003 . . . 08210003 GO TO IRXXXX, (1000, 2000, 3000) 08220003 C 08230003 C 08240003 END 08250003 CA8080 08260003 CAEND 08270003 CTITLEMultiple Entry 08280006 CA 08290003 CA8080 08300003 7 08310003 CAINDMSUBNAM -- GENERAL STATEMENT APPLICABLE TO ALL ENTRY POINTS 08320003 THIS CARD BECOMES A TABLE OF CONTENTS ENTRY. 08330011 08340003 9 08350003 CTITLE ENTRY1 -- FUNCTION OR PURPOSE OF THIS ENTRY POINT 08360003 CA AUTHOR ............. 08370003 CA DESIGNER ............. 08380003 CA LANGUAGE ............. 08390003 CA SYSTEM ............. 08400003 CA WRITTEN MO-DA-YR 08410003 C REVISED MO-DA-YR BY PROGRAMMER FOR REASON. 08420003 C REVISED 08430003 CA 08440003 CA 08450003 7 08460003 CA CALL ENTRY1 (A, M, B, N, ...) 08470003 CA ... 08480003 CA ARGUMENT DESCRIPTION AS PER SINGLE ENTRY POINT PREVIOUSLY DEFINED.08490011 CA ... 08500003 CA DESCRIPTION OF ENTRY-- PURPOSE, FUNCTIONS, ETC. 08510003 CA ... 08520003 9 08530003 CTITLE ENTRY2 -- FUNCTION OR PURPOSE OF THIS ENTRY POINT 08540003 CA AUTHOR 08550003 CA . . . 08560003 7 08570003 CA CALL ENTRY2 (A, M, B, N, ...) 08580003 CA ... 08590003 CA ARGUMENT DESCRIPTION AS PER SINGLE ENTRY POINT PREVIOUSLY DEFINED.08600011 CA ... 08610003 CA DESCRIPTION OF ENTRY-- PURPOSE, FUNCTIONS, ETC. 08620003 CA ... 08630003 C 08640003 C EJECT 08650003 9 08660003 CTITLE ENTRY3 -- FUNCTION OR PURPOSE OF THIS ENTRY POINT 08670003 CA AUTHOR 08680003 CA . . . 08690003 7 08700003 CA CALL ENTRY3 (A, M, B, N, ...) 08710003 CA ... 08720003 CA ARGUMENT DESCRIPTION AS PER SINGLE ENTRY POINT PREVIOUSLY DEFINED.08730011 CA ... 08740003 CA DESCRIPTION OF ENTRY--PURPOSE, FUNCTIONS, ETC. 08750003 CA ... 08760003 CA 08770003 C 08780003 SUBROUTINE SUBNAM 08790003 C 08800003 IMPLICIT INTEGER (A-Z) 08810003 EXTERNAL ...... SUBROUTINES CALLED BY ENTRY POINTS ONLY. 08820003 COMMON COM ( 1) 08830003 C 08840003 7 08850003 COMMON /P/ STARTP 08860003 COMMON /P/ ...... 08870003 COMMON /P/ ENDP 08880003 08890003 REAL ARRAYS--IN PARAMETER LIST 08900003 REAL ARRAYS--LOCAL 08910003 INTEGER ARRAYS--LOCAL 08920003 REAL VARIABLES AND CONSTANTS--LOCAL 08930003 INTEGER VARIABLES AND CONSTANTS--LOCAL 08940003 08950003 ENTRY ENTRY1 (A, N, B, M, ...) 08960003 . . . 08970003 . . . 08980003 . . . 08990003 RETURN 09000003 C 09010003 C 09020003 ENTRY ENTRY2 (C, I, D, J, ...) 09030003 . . . 09040003 . . . 09050003 . . . 09060003 RETURN 09070003 C 09080003 C 09090003 ENTRY ENTRY3 (E, K, F, L, ...) 09100003 . . . 09110003 . . . 09120003 . . . 09130003 RETURN 09140003 C 09150003 C 09160003 END 09170003 CA8080 09180003 CAEND 09190003 CTITLEExample Subroutine 09200006 CA 09210003 CA8080 09220003 CTITLESDPROC -- PROCESS DRIVER FOR SEISMIC APPLICATIONS. 09230003 CA AUTHOR .............. 09240003 CA DESIGNER .............. 09250003 CA LANGUAGE FORTRAN 09260006 CA SYSTEM IBM AND CRAY 09270006 CA WRITTEN MO-DA-YR 09280003 C REVISED MO-DA-YR BY PROGRAMMER FOR REASON. 09290003 C REVISED 09300003 CA 09310003 CA 09320003 CA CALL SDPROC (INH, INTR, OH, OTR) 09330003 CA 09340003 CA IN/OUT ARGUMENT TYPE DESCRIPTION 09350003 CA 09360003 CA IN INH I4 INPUT TRACE HEADER 09370003 CA IN INTR R4 INPUT TRACE 09380003 CA OUT OH I4 OUTPUT TRACE HEADER 09390003 CA OUT OTR R4 OUTPUT TRACE 09400003 CA 09410003 CA 09420003 CA THIS SUROUTINE SERVES AS A DRIVER OF A SEISMIC APPLICATION 09430003 CA PROCESS IN THE SPARC SYSTEM. GIVEN AN INPUT TRACE IT WILL: 09440003 CA 09450003 CA 1. INITIALIZE THE DRIVER 09460003 CA 2. RETRIEVE PROCESSING PARAMETERS 09470003 CA 3. CALL A SEISMIC APPLICATION SUBROUTINE 09480003 CA 4. UPDATE ITS REPORTING AREA 09490003 CA 5. RETURN THE PROCESSED TRACE 09500003 CA 6. EXIT 09510003 CA 7. PERFORM STEPS 2 THRU 6 FOR EACH INPUT TRACE RECEIVED. 09520003 CA 09530003 CA 09540003 C EJECT 09550003 CD WARNIER DIAGRAM (OPTIONAL DOCUMENTATION) 09560003 CD =============== 09570003 CD +-- 09580003 CD | RECEIVE TRACE 09590003 CD | +-- 09600003 CD | INITIALIZE DRIVER --| PRINT HEADING 09610003 CD | | GET LOCAL MEMORY REQUIREMENTS 09620003 CD | | BUILD PARAMETER ADDRESS TABLE 09630003 CD | | SORT PARAMETER ADDRESS TABLE 09640003 CD | EOR | READ PROCESSING RANGES 09650003 CD | | REPORT PROCESSING MODE 09660003 CD | +-- 09670003 CD | +-- 09680003 CD PROCESS | | RETRIEVE LOCAL VARIABLES 09690003 CD SEISMIC | PROCESS TRACE ------| RETRIEVE TRACE HEADER VARIABLES 09700003 CD TRACE | | IF TRACE NOT TO BE PROCESSED - EXIT 09710003 CD | | RETRIEVE PROCESSING PARAMETERS 09720003 CD | | CALL APPLICATION SUBROUTINE 09730003 CD | | UPDATE REPORTING AREA 09740003 CD | | RESTORE LOCAL VARIABLES 09750003 CD | +-- 09760003 CD | EXIT 09770003 CD +-- 09780003 CD 09790003 C EJECT 09800003 C 09810003 C 09820003 C LOCAL OR INTERNAL ARRAYS. 09830003 C 09840003 C NAME TYPE DESCRITPION 09850003 C 09860003 C DATTR ( 96) I4 DATA ATTRIBUTES 09870003 C DENTRY ( 104) I4 DATA ENTRIES ARRAY 09880003 C DLOCAL ( 50) I4 LOCAL VARIABLES 09890003 C PSHOT ( 24) 14 PROCESSED SHOTPOINTS OR DEPTH POINTS 09900003 C 09910003 C LOCAL OR INTERNAL VARIABLES AND CONSTANTS.(OPTIONAL DOCUMENTATION)09920003 C 09930003 C NAME TYPE DESCRIPTION 09940003 C 09950003 C CBSPT I4 BEGINNING SHOTPOINT OR DEPTH POINT 09960003 C CDP I4 COMMON DEPTH POINT ENSEMBLE NUMBER 09970003 C CESPT I4 ENDING SHOTPOINT OR DEPTH POINT 09980003 C DAP I4 COUNTER FOR PARAMETER READ AND WRITE SUBR. 09990003 C DAT I4 DISK ADDRESS TABLE 10000003 C DTEND I4 POINTER TO END OF DISK ADDRESS TABLES 10010003 C DA1 I4 POINTER TO PARAMETER FILE 10020003 C GATH I4 GATHER OR SHOTPOINT ORDER 10030003 C IC I4 UNRESERVED SCRATCH TRACE-BLOCK INDEX 10040003 C TICD I4 TRACE IDENTIFICATION CODE 10050003 C LLOCAL I4 LENGTH OF DLOCAL, WORDS 10060003 C NOPAR I4 NUMBER OF PARAMETERS 10070003 C NOSAMP I4 NUMBER OF SAMPLE POINTS 10080003 C NOWDS I4 NUMBER OF WORDS 10090003 C NS I4 NUMBER OF SHOTPOINTS OR DEPTH POINTS 10100003 C PMODE I4 PROCESSING MODE 10110003 C POS I4 CDP OR TWICE SHOTPOINT NUMBER 10120003 C POSL I4 LAST SHOTPOINT OR DEPTH POINT NUMBER 10130003 C RANG I4 POINTER TO PROCESSING RANGE 10140003 C RANGE I4 POINTER TO END OF PROCESSING RANGE 10150003 C RLENG I4 RECORD LENGTH IN MS. 10160003 C SAMPR I4 SAMPLE INTERVAL IN MS. 10170003 C SHOT I4 ENERGY SOURCE POINT NUMBER. 10180003 C SHOTL I4 LAST SHOTPOINT 10190003 C SHOTT I4 EITHER CDP OR SHOTPOINT NUMBER 10200003 C SPLOCN I4 SHOT POINT LOCATION 10210003 C SPT I4 STARTING POINT 10220003 C THL I4 TRACE HEADER LENGTH 10230003 C TNS I4 TOTAL NUMBER OF SHOT OR DEPTH POINTS PROCESSED10240003 C TPS I4 TRACES PER SHOTPOINT OR DEPTH POINT 10250003 C TRACE I4 TRACE NUMBER FROM TRACE HEADER 10260003 C XDST I4 DISTANCE FROM SHOT (FROM TRACE HEADER) 10270003 C 10280003 C 10290003 C EJECT 10300003 SUBROUTINE SDPROC (INH, INTR, OH, OTR) 10310003 C 10320003 IMPLICIT INTEGER (A-Z) 10330003 C 10340003 COMMON COM ( 1) 10350003 C 10360003 7 10370003 COMMON /P/ STARTP 10380003 COMMON /P/ . 10390003 COMMON /P/ . 10400003 COMMOPN /P/ . 10410003 COMMON /P/ ENDP 10420003 C 10430003 C 10440003 C REAL ARRAYS IN PARAMETER LIST. 10450003 C 10460003 REAL INTR (1) 10470003 REAL OTR (1) 10480003 C 10490003 C INTEGER ARRAYS IN PARAMETER LIST. 10500003 C 10510003 INTEGER INH (1) 10520003 INTEGER OH (1) 10530003 C 10540003 C INTEGER ARRAYS--LOCAL 10550003 C 10560003 INTEGER DATTR ( 96) 10570003 INTEGER DENTRY (104) 10580003 INTEGER DLOCAL ( 50) 10590003 INTEGER PSHOT ( 24) 10600003 C 10610003 C 10620003 C DENTRY IS AN ARRAY TO HOLD A PARAMETER RECORD. THE DEFINITIONS 10630003 C OF THE FIRST EIGHT WORDS ARE FIXED. THE REMAINING WORDS ARE 10640003 C FOR VARIABLE PARAMETERS AND ARE USUALLY ADDRESSED USING "DATTR". 10650003 C THE MAXIMUM LENGTH OF DENTRY IS 104 BECAUSE OF THE I/O ROUTINES. 10660003 C 10670003 EQUIVALENCE (DCTYP , DENTRY (03)) 10680003 EQUIVALENCE (SPT , DENTRY (04)) 10690003 EQUIVALENCE (EXTRA , DENTRY (05)) 10700003 EQUIVALENCE (NOPAR , DENTRY (06)) 10710003 EQUIVALENCE (PMODE , DENTRY (07)) 10720003 EQUIVALENCE (SPLOCN , DENTRY (08)) 10730003 EQUIVALENCE (DATTR(1) , DENTRY (09)) 10740003 C EJECT 10750003 C 10760003 C DLOCAL IS AN ARRAY USED TO HOLD PARAMETER VALUES THAT ARE UNIQUE 10770003 C TO EACH OCCURRENCE OF THE PROCESS. IT MAY BE DIMENSIONED FOR 10780003 C THE NECESSARY LENGTH. 10790003 C 10800003 EQUIVALENCE (DAT , DLOCAL (01)) 10810003 EQUIVALENCE (DTEND , DLOCAL (02)) 10820003 EQUIVALENCE (RANG , DLOCAL (03)) 10830003 EQUIVALENCE (RANGE , DLOCAL (04)) 10840003 EQUIVALENCE (CBSPT , DLOCAL (05)) 10850003 EQUIVALENCE (CESPT , DLOCAL (06)) 10860003 EQUIVALENCE (GATH , DLOCAL (07)) 10870003 EQUIVALENCE (NS , DLOCAL (09)) 10880003 EQUIVALENCE (TNS , DLOCAL (10)) 10890003 EQUIVALENCE (PSHOT(1) , DLOCAL (11)) 10900003 C EJECT 10910003 C REAL VARIABLES AND CONSTANTS--LOCAL 10920003 C 10930003 C 10940003 C INTEGER VARIABLES AND CONSTANTS--LOCAL 10950003 C 10960003 INTEGER LLOCAL / 50 / 10970003 INTEGER XYZ / 'XYZ ' / 10980003 C 10990003 C CHECK IF FIRST TIME THROUGH 11000003 C 11010003 IF (KPFCF .EQ. 0) GO TO 100 11020003 C 11030003 C INITIALIZATION 11040003 C ============== 11050003 C 11060003 C FIRST TIME THROUGH 11070003 C 11080003 KPFCF = 0 11090003 DAP = 1 11100003 C 11110003 C PRINT HEADING 11120003 C 11130003 CALL USPHD (2, ACLNAM,KPNA, KPRNO, 0, 0, KPPRNT) 11140003 C 11150003 NOWDS = LLOCAL 11160003 C 11170003 C GET LOCAL MEMORY REQUIREMENTS 11180003 C 11190003 CALL UPRESM (NOWDS) 11200003 IF (NOWDS .EQ. 0) GO TO 1700 11210003 IC = KPIUSM 11220003 C 11230003 C BUILD DISK ADDRESS TABLES FOR PROCESSING PARAMETERS 11240003 C 11250003 DAT = IC 11260003 SHOTL = -999999 11270003 DAP = 1 11280003 C 11290003 10 CALL FORP(KPNA, KPRNO, DAP, 104, DENTRY, *20 )11300010 IF (DCTYP .NE. XYZ .OR. SPT .EQ. SHOTL) GO TO 10 11310003 IF (IC+1 .GT. KPIUSM+KPNUSM) GO TO 1700 11320003 COM(IC) = DAP - 1 11330003 COM(IC+1) = SPLOCN 11340003 SHOTL = SPT 11350003 IC = IC + 2 11360003 GO TO 10 11370003 C 11380003 20 DTEND = IC - 1 11390003 EJECT 11400003 C 11410003 C SORT THE DISK ADDRESS TABLES 11420003 C 11430003 IF (DAT+2 .GT. DTEND ) GO TO 40 11440003 IPS = DAT + 2 11450003 IP = DTEND 11460003 C 11470003 DO 35 J = IPS,IP,2 11480003 C 11490003 DO 30 K = IPS,IP,2 11500003 IF (COM(K-1) .LT. COM(K+1)) GO TO 30 11510003 H1 = COM(K-2) 11520003 H2 = COM(K-1) 11530003 COM(K-2) = COM(K) 11540003 COM(K-1) = COM(K+1) 11550003 COM(K) = H1 11560003 COM(K+1) = H2 11570003 C 11580003 30 CONTINUE 11590003 C 11600003 35 CONTINUE 11610003 C READ THE PROCESSING RANGES AND SAVE IN COM 11620003 C 11630003 40 RANG = IC 11640003 DAP = 1 11650003 C 11660003 50 CALL FORP(KPNA,KPRNO,DAP,104,DENTRY, *60) 11670010 IF (S1CPCH(DCTYP, 1, 'PTS', 1, 3) .NE. 0) GO TO 50 11680003 IF (IC + NOPAR .GT. KPIUSM + KPNUSM) GO TO 1700 11690003 CALL ARMVE (DATTR, COM(IC), NOPAR) 11700003 IC = IC + NOPAR 11710003 RANGE = IC - 1 11720003 GO TO 50 11730003 C 11740003 60 NOWDS = IC - KPIUSM 11750003 CALL UPRESM (NOWDS) 11760003 IF (NOWDS .EQ. 0) GO TO 1700 11770003 C 11780003 CBSPT = -999999 11790003 CESPT = -999999 11800003 NS = 0 11810003 TNS = 0 11820003 C REPORT PROCESSING MODE 11830003 IF (S1CPCH(PMODE, 2 ,'D', 1, 1) .EQ. 0) GO TO 70 11840003 GATH = 0 11850003 WRITE (KPPRNT, 9000) 11860003 GO TO 110 11870003 70 GATH = 1 11880003 WRITE (KPPRNT, 9010) 11890003 GO TO 110 11900003 EJECT 11910003 C 11920003 C PROCESS THE SEISMIC TRACE 11930003 C ========================= 11940003 C 11950003 C RETRIEVE LOCAL VARIABLES FOR SERIAL REENTRANCE 11960003 C 11970003 1000 CALL ARMVE (COM(KPIRSM), DLOCAL, LLOCAL) 11980003 C CHECK FOR END OF FILE 11990003 IF (KPMITF .EQ. 0) GO TO 1800 12000003 C 12010003 C 12020003 1010 IF(KPBUGF .NE. 1) GO TO 1020 12030003 KKKK = KPIRSM + KPNRSM - 1 12040003 WRITE (KPPRNT, 9050) (COM(I), I = KPIRSM, KKKK) 12050003 C 12060003 C RETRIEVE TRACE HEADER VARIABLES REQUIRED FOR 12070003 C PROCESSING THIS TRACE. 12080003 C 12090003 1020 CALL USRTHV (INH, 'THTICD ', TICD) 12100003 IF (TICD .GE. 2) GO TO 1820 12110003 CALL USRTHV (INH, 'THSSP ', SHOT) 12120003 CALL USRTHV (INH, 'THCDPN ', CDP) 12130003 CALL USRTHV (INH, 'THNS ', NOSAMP) 12140003 CALL USRTHV (INH, 'THSI ', SAMPR) 12150003 SAMPR = SAMPR/1000 12160003 RLENG = NOSAMP * SAMPR 12170003 CALL USRTHV (INH, 'THSLN ', POS) 12180003 CALL USRTHV (INH, 'THORTN ', TRACE) 12190003 CALL USRTHV (INH, 'THXDST ', XDST) 12200003 C 12210003 SHOTT = SHOT 12220003 IF (GATH .EQ. 0) GO TO 1130 12230003 POS = CDP 12240003 SHOTT = CDP 12250003 CALL USRTHV (INH, 'THCDPT ', TRACE) 12260003 C 12270003 C CHECK IF CURRENT PROCESSING PARAMETERS 12280003 C ARE RESIDENT FOR THIS SHOTPOINT. 12290003 C 12300003 1130 IF (CBSPT .LE. SHOTT .AND. SHOTT .LE. CESPT) GO TO 1200 12310003 IF (CBSPT .GE. SHOTT .AND. SHOTT .GE. CESPT) GO TO 1200 12320003 C 12330003 C CURRENT PARAMETERS ARE NOT RESIDENT, SEARCH THE 12340003 C RANGE TABLE FOR THE INPUT SHOT NUMBER. 12350003 C 12360003 DO 1140 J = RANG,RANGE,2 12370003 IF (COM(J) .LE. SHOTT .AND. SHOTT .LE. COM(J+1)) GO TO 1150 12380003 IF (COM(J) .GE. SHOTT .AND. SHOTT .GE. COM(J+1)) GO TO 1150 12390003 C 12400003 1140 CONTINUE 12410003 C THIS SHOTPOINT IS NOT TO BE PROCESSED 12420003 GO TO 1820 12430003 EJECT 12440003 C 12450003 C GET DISK ADDRESS FOR PROCESSING PARAMETERS 12460003 C 12470003 1150 IPS = DAT 12480003 IP = DTEND - 2 12490003 IF (IP .LT. IPS) GO TO 1170 12500003 C 12510003 DO 1160 J = IPS,IP,2 12520003 IF (COM(J+1) .EQ. POS .OR. COM(J+3) .GT. POS) GO TO 1180 12530003 C 12540003 1160 CONTINUE 12550003 C 12560003 1170 J = DTEND - 1 12570003 C 12580003 C READ THE PARAMETERS FROM THE SEISPARM FILE 12590003 C 12600003 1180 DA1 = COM(J) 12610003 CTRE = CTR 12620003 CALL FORP (KPNA, KPRNO, DA1, 104, DENTRY, *1820) 12630010 C 12640003 C MOVE PARAMETERS INTO COM 12650003 C . 12660003 C . 12670003 C . 12680003 C . 12690003 C REPORTING AREA 12700003 C ============== 12710003 1200 IF (NS .EQ. 0) GO TO 1210 12720003 IF (PSHOT(NS) .EQ. SHOTT) GO TO 1220 12730003 IF (NS .LT. 24) GO TO 1210 12740003 C REPORT SHOTPOINTS PROCESSED 12750003 WRITE (KPPRNT, 9030) TNS, PSHOT 12760003 NS = 0 12770003 C 12780003 1210 NS = NS + 1 12790003 TNS = TNS + 1 12800003 PSHOT(NS) = SHOTT 12810003 C 12820003 C 12830003 C 12840003 1220 CONTINUE 12850003 EJECT 12860003 C 12870003 C CALL APPLICATION SUBROUTINE 12880003 C =========================== 12890003 C 12900003 CALL SAXXX (P1, P2, ... , KPRTF) 12910003 C ON NORMAL RETURN 12920003 IF (KPRTF .EQ. 0) GO TO 1830 12930003 C 12940003 C EXIT AREA 12950003 C ========= 12960003 1700 WRITE (KPPRNT, 9040) 12970003 KPRTF = -1 12980003 GO TO 1840 12990003 C 13000003 C PRINT REMAINING REPORT 13010003 C 13020003 1800 KPLOTF = 0 13030003 KPRTF = 0 13040003 C 13050003 WRITE (KPPRNT, 9030) TNS, (PSHOT(I), I = 1, NS) 13060003 GO TO 1840 13070003 C 13080003 C IN THIS SAMPLE PROGRAM 1820 IS BEING USED WHEN THE INPUT TRACE 13090003 C HAS BEEN KILLED OR THE TRACE IS NOT TO BE PROCESSED. 13100003 C 13110003 1820 KPRTF = 2 13120003 C 13130003 C SAVE LOCAL VARIABLES 13140003 C 13150003 1830 CALL ARMVE (DLOCAL, COM(KPIRSM), LLOCAL) 13160003 C 13170003 1840 RETURN 13180003 C 13190003 9000 FORMAT (' COUNT SHOTPOINTS PROCESSED') 13200003 C 13210003 9010 FORMAT (' COUNT DEPTH POINTS PROCESSED') 13220003 C 13230003 9030 FORMAT (1X,I4,4(2X,6I5)) 13240003 C 13250003 9040 FORMAT (5X,'*** NOT ENOUGH MEMORY AVAILABLE') 13260003 C 13270003 9050 FORMAT (1X,20I5) 13280003 C 13290003 END 13300003 CA8080 13310003 CAEND 13320003