HP 3000 Computer Systems HP Transact Documentation Update Notice ABCDE HP Part No. 32247-90028 Printed in U.S.A.
The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or use of this material. Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard.
Printing History The following table lists the printings of this document, together with the respective release dates for each edition. The software version indicates the version of the software product at the time this document was issued. Many product releases do not require changes to the document. Therefore, do not expect a one-to-one correspondence between product releases and document editions.
About This Manual This manual is a reference for programming in the Transact programming language. It assumes that you have a working knowledge of computer programming and the HP 3000 computer system, including the subsystems TurboIMAGE and VPLUS. The manual contains the following chapters and appendixes: Chapter 1, \Introduction to Transact," describes the features and bene ts of Transact. Chapter 2, \Program Structure," describes the program structure of Transact.
Introducing MPE/iX MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest in a series of forward-compatible operating systems for the HP 3000 line of computers. In Hewlett-Packard documentation and in talking with other HP 3000 users, you will encounter references to MPE XL, the direct predecessor of MPE/iX. MPE/iX is a supersest of MPE XL. All programs written for MPE XL will run without change under MPE/iX, and you can continue to use MPE XL system documentation.
Transact Enhancements This edition of the manual includes descriptions of the enhancements that have been made to Transact. Here is a list of these enhancements and where they are located in the manual.
LIST OF EFFECTIVE PAGES The List of E ective Pages gives the date of the current edition and of any pages changed in updates to that edition. Within the manual, any page changed since the last edition is indicated by printing the date the changes were made on the bottom of the page. Substantive changes are marked with a vertical bar in the margin. Changes due simply to changes in pagination or the correction of typographical errors may or may not be so dated and marked.
Data Types and Databases There are several di erences between the data types for databases and those for Transact. The main di erence is that databases require all data items to be de ned as whole words on word (16-bit) boundaries. To maintain consistency, you can de ne a data item in Transact with an odd number of bytes, but specify that the data item be stored in whole words. For example, you can de ne a data item in Transact as 9(5,0,6) to specify 5 digits, stored as 6 bytes.
When the Transact/V processor interprets the p-code, it, too, looks in the Dictionary/V data dictionary for unde ned data items, including those which could not be resolved from a System Dictionary data dictionary. These data items can be those not satis ed during compilation or data items de ned to be satis ed at run time by a DEFINE(ITEM) item-name * statement. If the processor cannot nd the data items in the data dictionary, it issues an error message and terminates processing.
Using the LOCK Option with the Database Access Verbs The LOCK option applies to all database access verbs, which include DELETE, FIND, GET, OUTPUT, PUT, REPLACE, and UPDATE. The LOCK option can be used to override the SET(OPTION) NOLOCK statement for any speci c verb. Tables 6-2 and 6-3 show how locking is applied with the possible combinations of locking methods for database and MPE and KSAM les, respectively. See the description of the individual verbs in Chapter 8 for more information.
Using the LOCK Option with the LOGTRAN Statement Locking across a transaction can be handled by transaction-level locking executed when you specify the LOCK option on the LOGTRAN statement. Transaction locking can be used with or without database logging. The syntax is: LOGTRAN(BEGIN) base,log-message[,option-list]; where option-list includes the LOCK option in the following format: LOCK(setname[(cond)][,setname[(cond)]]...
7 Error Handling Transact has a signi cant amount of error processing built into the run-time environment. This chapter explains the error handling process and the e ect of the STATUS option on various verbs, especially when errors are detected.
Automatic Error Handling Transact automatically traps various types of errors encountered during the execution of a program and takes certain predetermined actions. Transact traps errors during data entry, during database or le operations, and during arithmetic calculations in LET expressions. Data Entry Errors Transact validates a value entered as a response to a data entry prompt.
Example This example shows what is displayed when you enter EXPLAIN TVB 1070 at the command line: --------------------------------------------------------DATABASE BUFFER NOT ON WORD BOUNDARY (1070) The data buffer for a database operation must start on a word boundary. If necessary, insert a one-character fill item before the first data item of the database list or use the ALIGN option of the LIST verb. MSG GROUP: Transact/V MSG CATALOG: RAPIDCAT.PUB.
CALL When calling a Transact subprogram, arithmetic traps and control-y are not disabled. Trap handling in the main program is the same throughout the Transact subprogram. In batch mode, the called subprogram issues an error message and terminates. Control is returned to the main program and processing continues. When calling an Inform or Report program, control-y is rst disabled then re-enabled after the Inform or Report program completes. Arithmetic traps are not enabled or disabled.
8 Transact Verbs This chapter contains detailed speci cations for using Transact verbs. The verb speci cations are arranged in alphabetic order for easy reference. Each speci cation contains a single phrase description of the verb's functions. The verb's syntax is listed, followed by a general description of the syntax and how the verb is used. The syntax for most of the verbs is described in terms of statement parts. The speci cations for each statement part are provided in detail.
CALL Transfers execution to another Transact program or to a Report/V or Inform/V program. Syntax 2 2 CALL le-name ( password, 32 3 32 3 mode ) ,option-list ; CALL passes control to another Transact program or to a Report/V or Inform/V program. The called program operates as if it were the main program, but it shares all or part of the calling program's data register space. The called program returns to the calling program with an EXIT statement.
CALL The name of the called program does not need to be available until run time. There are advantages and disadvantages to both types of call. The primary advantage of static calls over dynamic calls is superior run-time performance. Dynamic calls must use HPGETPROCPLABEL whenever a CALL statement is executed, and this intrinsic must search the various libraries and load the requested program.
CALL It is possible to supply the called program with more than one password. This can be accomplished by de ning a compound item of type X or U, where the size of each element in the compound is 8 characters. If a list of passwords is passed to the called program, the rst password on the list is used to open the rst database speci ed in the SYSTEM statement, the second password on the list is used to open the second database speci ed, and so on.
CALL Note When Transact CALLs a Transact subprogram, the data register space allocated to the subprogram is determined by the DATA= and SIZE= parameters of the CALL statement, not the DATA= option of the SYSTEM statement in the called program. The maximum size of the data register, however, is determined by the DATA= option of the main program's SYSTEM statement. SWAP INFORM REPORT STATUS A request to write part of the caller's stack space out to a temporary MPE le before the CALL is made.
CALL Error messages are suppressed by the ERROR= option on the LET verb. When the STATUS option is not used on the CALL verb, Transact does not alter the calling program's status register. The STATUS option can be used only with called Transact programs. The Transact compiler returns an INVALID OPTION error message when used with called Report/V and Inform/V programs.
CALL The next example shows how multiple passwords and multiple modes can be passed to a called program. DEFINE(ITEM) PASSWORD-LIST 2 X(8) : MODE-LIST 2 I(2) : MODE-ITEM I(2) = MODE-LIST(1); MOVE (PASSWORD-LIST) = "PASS1 PASS2 "; LET (MODE-ITEM) = 1; LET OFFSET(MODE-ITEM) = 2; LET (MODE-ITEM) = 5; CALL ORDPROC (PASSWORD-LIST,MODE-LIST), DATA=*; This example shows the programs MAIN and CALC. MAIN uses a CALL verb with and without the STATUS option.
CALL SYSTEM CALC; DEFINE(ITEM) ZEROS I(5,,2): PSTATUS I(5,,4); LIST ZEROS:PSTATUS; LET STATUS = 222; LET (ZEROS) = (ZEROS) / (ZEROS); <> LET (PSTATUS) = STATUS; DISPLAY "CALC's STATUS REGISTER AFTER ERROR>>",LINE=2:PSTATUS,NOHEAD; EXIT; END; ************************** RESULTS ***************************** ERROR: INTEGER DIVIDE BY ZERO (PROG 54,6) [CALC] CALC's STATUS REGISTER AFTER ERROR>> MAIN's STATUS IS STILL 111.
CALL DEFINE(ITEM) ZEROS I(5,,2): PSTATUS I(5,,4); LIST ZEROS:PSTATUS; LET (ZEROS) = (ZEROS) / (ZEROS), ERROR= NEXT-LINE(*); <> NEXT-LINE; LET (PSTATUS) = STATUS; <> DISPLAY "CALC's STATUS REGISTER AFTER ERROR>> ",LINE=2:PSTATUS,NOHEAD; EXIT; END; ************************** RESULTS ***************************** CALC's STATUS REGISTER AFTER ERROR>> 3 MAIN's STATUS IS STILL 111. CALC's STATUS REGISTER AFTER ERROR>> 3 MAIN's STATUS IS NOW 0.
CLOSE Closes an MPE or KSAM le, a data set or database, or a VPLUS forms le. Syntax 2 3 CLOSE le-name ,option-list ; CLOSE closes and rewinds an MPE or KSAM le or a data set, or closes the entire database. Except to rewind or set a le or data set to its beginning, you need not use CLOSE. Transact automatically closes all les and data sets at the end of a command sequence and at the end of a program.
CLOSE option-list One or more of the following options separated by commas: Suppresses the default error return that Transact ERROR=label normally takes. Instead, the program branches to the ([item-name ]) statement identi ed by label , and the stack pointer for the list register is set to the data item item-name . Transact generates an error at execution time if the item cannot be found in the list register. The item-name must be a parent.
DATA Prompts for a value and changes the appropriate location in the data, argument, match, and/or update registers. Syntax DATA[(modi er)][item-name][("prompt-string")][,option-list][:item-name...] ... ; DATA prompts the user for a value and, depending on the syntax option chosen, places the value in one or more registers. The registers a ected depend on the verb modi er. Available modi ers are: none Places value in data register. (See Syntax Option 1.
DATA Statement Parts modi er item-name * prmpt-string optn-list October 1996 Changes or enhances the action of DATA; often indicates the register to which the input value should be added or the register whose value should be changed. The Syntax Options subsection below describes the impact of each modi er in detail. The name of the data item in the list register whose value should be added or changed in the appropriate register.
DATA STATUS Suppresses normal processing of \]" and \]]", which cause an escape to a higher processing or command level. Meaning Status Register Value 01 User entered a \]". 02 User entered a \]]". 03 User entered one or more blanks and no non-blank characters. 04 If timeout is enabled with a FILE(CONTROL) statement, a timeout has occurred. >0 Number of characters (includes leading blanks if BLANKS option is speci ed); no trailing blanks are counted.
DATA (3) DATA(KEY) {item-name}[("prompt-string")][,option-list][:item-name . . . ] . . . ; { * } DATA(KEY) places the value entered as a response to prompt-string in the argument register. If item-name is speci ed, this name is used as the prompt for user input, unless this name is overridden by a prompt-string . If \*" is speci ed, then the current name in key register is used as the prompt for user input. The key register is changed by this verb only if it is empty.
DATA For example, if the program contains the data statement DATA(MATCH) CUSTNO,GE; and if the user responds to the prompt by entering 079333, then only customer numbers greater than or equal to 079333 will be selected. (5) DATA(PATH){ item-name}[("prompt-string")][,option-list][:item-name . . . ] . . . ; { * } DATA(PATH) places the value entered as a response to prompt-string in the data register.
DATA This example causes the following prompts to be displayed the rst time data is entered: PRODUCT(= )> QUANTITY(=0)> If the values \grapefruit" and \10" are entered, the prompts appear like this when displayed again: PRODUCT(=grapefruit)> QUANTITY(=10)> If an alphanumeric string is longer than 30 characters, the rst 30 characters are displayed: PRODUCT(=mason valley delightful grapef...)> The trailing periods ( . . . ) indicate that the value is too long.
DATA Alternatively, if the user wants to wait for each prompt, the dialogue could be: Enter Enter Enter Enter customer address> 312 Alba Road city> San Jose 2-letter state code> CA 5-digit zip code> 95050 In either case, the entered data is moved to the data register locations associated with ADDRESS, CITY, STATE, and ZIP. If the user presses 4Return5 in response to any single prompt, the associated area of the data register is set to blanks.
DEFINE DEFINE Speci es de nitions of item names, names of MPE V system intrinsics, or segmented program control labels to be used by the compiler. Syntax DEFINE(modi er) de nition-list ; The DEFINE statement is used to de ne items, entry points into program segments, or intrinsics called with the PROC statement. DEFINE statements are generally the rst statements that follow the SYSTEM statement in a Transact program.
DEFINE (3) DEFINE(ITEM) item-name [count] [type(size[,decimal-length[,storage-length]])] [=parent-name[(position)]] [,ALIAS=(alias-reference)] [,COMPUTE=arithmetic-expression] [,EDIT="edit-mask"] [,ENTRY="entry-text"] [,HEAD="heading-text"] [,INIT=[value|(BINARY(value))|(HEX(value))|(OCTAL(value))]] [,OPT] [:item-name . . . ] . . . ; This option de nes an item-name not de ned in the data dictionary. It can also be used to rede ne items already de ned in the data dictionary.
DEFINE If type is followed by a \+", then the item is unsigned, and can have positive values only. Data entry values are validated as positive and, if the type is Z or P, positive unsigned value formats are generated. Items de ned as type E are displayed in the format: n.nnE+nn , but cannot be entered in this format; they may be entered as integer or real numbers. (See Chapter 3, \Data Items," for detailed descriptions of data types.
DEFINE The following is an example of rede nition of a parent item de ned as \NAME". DEFINE(ITEM) NAME X(32): FNAME X(10)=NAME(1): MIDINIT X(1)=NAME(11): LNAME X(21)=NAME(12); position When working with KSAM or MPE les, it is useful to de ne the record as a parent item and the elds as child items. (See the example in the description of the SYSTEM verb.) The byte position in the parent item that is the starting position of the child item. Begin counting at position 1. The default is 1.
DEFINE COMPUTE= arithmetic- expression EDIT=\edit-string " ENTRY=\entry-text " HEAD=\heading-text " INIT=[value ] An arithmetic expression that speci es the computation to be performed before the item is used in a DISPLAY, OUTPUT, or LET statement. It may contain two or more variables separated by one or more arithmetic operators. Use the form shown for the LET statement. Default edit mask used for the item's value in any display.
DEFINE DEFINE(ITEM) HEX2 I(5,,4), INIT=(HEX(ffff8000)); The last example de nes an initial value of 2147483647, the maximum possible using a binary, octal, or hexadecimal base. Eight bytes of storage are required. DEFINE(ITEM) HEX3 I(10,,8), INIT=(HEX(7fffffff)); The INIT= option cannot be used for child items. Note Initializing a positive type with a negative value results in a run-time error. OPT OPT is used in combination with the compiler control option, OPT@, OPTE, OPTH, OPTI, and OPTP.
DEFINE A marker item can be referenced by list pointer operations and list range options. Marker items are useful in conjunction with the SET modi er on the PROMPT verb. The PROMPT(SET) statement causes the contents of the list register to be de ned at execution time.
DEFINE In another example, a portion of a key is de ned as a \generic key": DEFINE(ITEM) RECORD DEL-CODE KEY-NUM GEN-KEY X(80): I(2) = RECORD(1): X(10) = RECORD(3): X(2) = RECORD(3); The key search is similar to that shown above; use the generic key (GEN-KEY) value to locate all records with key values starting with the same rst two characters.
DELETE DELETE Deletes KSAM les or data set entries. DELETE cannot be used with MPE les. Syntax 2 DELETE (modi er) 3 2 3 le-name ,option-list ; DELETE speci es the deletion of one or more KSAM le entries or data set entries. For multiple deletions, the entries to be deleted are determined by match criteria speci ed in the match register. If you do not specify match criteria for a multiple deletion, DELETE deletes all entries in a chain or in the entire le or data set, depending on the modi er.
DELETE Note DELETE(PRIMARY) deletes only one entry at the primary location, and the secondary entry, if any, automatically migrates to the primary location after the delete. RCHAIN le-name option-list Deletes entries from a detail set or a KSAM chain in the same manner as the CHAIN option, only in reverse order. For a KSAM le, this operation is identical to CHAIN. RSERIAL Deletes entries from a data set in the same manner as the SERIAL option, except in reverse order.
DELETE The match register can be used only with the modi ers CHAIN, RCHAIN, SERIAL, or RSERIAL. Each retrieved entry is placed in the area of the data register indicated by LIST= before any PERFORM= is executed, and then the delete is performed. For all options of range-list , the data items selected are the result of scanning the data items in the list register from top to bottom, where top is the most recent entry added to the list register. (See Chapter 4 for more information on registers.
DELETE is returned if duplicate entries are selected. LOCK 8-30 Transact Verbs If item-nameX and item-nameY are marker items (see the DEFINE(ITEM) verb) and if there are no data items between the two on the list register, no database access is performed. (item-nameX: ) All data items in the range from the last entry through the occurrence of item-nameX closest to the top of the list register.
DELETE PERFORM= statements, but is unlocked brie y before the next entry is retrieved. For a KSAM le, if LOCK is not speci ed on DELETE but is speci ed for the le in the SYSTEM statement, then the le is locked before each entry is retrieved, remains locked while the entry is processed by any PERFORM= statements, but is unlocked brie y before the next entry is retrieved. (DELETE is not allowed on MPE les.) Including the LOCK option overrides SET(OPTION) NOLOCK for the execution of the DELETE verb.
DELETE SOPT STATUS Suppresses the optimization of database calls. This option is primarily intended to support a database operation in a performed routine that is called recursively. The option allows a di erent path for the same detail set to be used at each recursive entry, rather than optimizing to the same path. It also suppresses generation of a call list of \*" after the rst call is made. Use SOPT if you are calling TurboIMAGE through the PROC or CALL verbs.
DELETE Examples In the following example, the programmer wants to be sure that an entry is not in MASTER-SET. Therefore, there are two acceptable conditions: either a status register value of zero (delete successful) or a status register value of 17 (database error 17|record not found) is acceptable.
DISPLAY Produces a display of values from the data register. Syntax DISPLAY[([ [TABLE],[FILE= mpe- le] ])][display-list] ...; DISPLAY generates a display from values in the data register. The display can be formatted and enhanced by character strings speci ed in the display-list . If you do not specify a format, the display can be formatted by any active FORMAT verb.
DISPLAY display- eld The following options can be used for display elds: A reference to a data item name in the list register (the data item name can be subscripted if the item referenced is an array item). A child item name whose parent item is in the list register. A character string delimited by quotation marks. If no display eld is speci ed, Transact defaults to a NULL (" ") character string. If the requested item cannot be found in the list register, then Transact generates an error at execution time.
DISPLAY CENTER COL=number CCTL=number and LINE, NOCRLF, or ROW, may a ect output due to con icting values. Valid range is 30{1025. Centers a display eld on a line. The entire eld, including leading or trailing blanks, is centered. Starts the display eld in the absolute column position speci ed by number . The rst column position is 1. Maximum is 299.
DISPLAY Note The number of digits available for the source number depends on the type of currency symbol. Thus, the same value might cause a eld over ow in some languages and not in others. * . ! , ( Fills eld with asterisks. Aligns the implied decimal point as speci ed in the dictionary or in a DEFINE(ITEM) de nition statement with this edit character in the edit mask and outputs the language-de ned radix character.
DISPLAY de ned can be used for $CPU and $PAGE. Special editing characters are used for $TIME and $TODAY. For $TIME, characters in the edit-mask string are processed as follows: H Displays the hour with no leading blank or zero if hour < 10. ZH Displays the hour with leading blank if hours < 10. HH Displays the hour with leading zero if hours < 10. 24 Displays the hour as expressed on a 24-hours clock; used as a pre x to H. M Displays the minute with no leading blank or zero if minute < 10.
DISPLAY Here are some examples of how edit masks change the format of the $TIME value 3:07:32 PM: Edit Mask Displayed Time HH:MM:SS 24H:M:S H:MM:SS a.a. ZH:ZM:SS AA 03:07:32 15:7:32 3:07:32 p.m. 3: 7:32 PM For $TODAY, characters in the edit mask string are processed as follows: D Displays the day of the month with no leading blank or zero if day < 10. ZD Displays the day of the month with leading blank if day < 10. DD Displays the day of the month with leading zero if day of the month < 10.
DISPLAY characters not de ned as an edit string character are inserted on a character by character basis. Various edit masks applied to the $TODAY date April 14, 1992, make it appear as follows: Edit Mask 3w. 3m DD, YYYY DD 3M, YY M-DD-YY MM/DD/YY DDD, YYYY Note Displayed Date Tue. Apr 14, 1992 14 APR, 92 4-14-92 04/14/92 105, 1992 When a numeric value to be printed is too large for the edit mask, a series of pound signs (#) are printed in place of the value, to indicate an over ow.
DISPLAY NOCRLF NOHEAD NOSIGN PAGE[=number ] RIGHT ROW=number SPACE[=number ] TITLE TRUNCATE ZERO[E]S October 1996 NEED= must appear with the rst item. Range is 1{99. Does not issue a carriage return and line feed for the display line containing the display eld. This parameter allows you to print output from the next DISPLAY statement on the same line where the previous display left o . NOCRLF is processed when a listing goes to the terminal or printer.
DISPLAY Redirecting Output To A File The formatted output generated by DISPLAY can be redirected to a speci ed le by using the FILE= option. This feature allows you to generate multiple reports and to save each in a di erent le. The only requirement is that the speci ed le must rst be identi ed by a corresponding SYSTEM statement using the FILE= option. If the le is not de ned in the SYSTEM statement, an INVALID FILE NAME error will occur during compilation.
DISPLAY This statement produces a display that prints the title \CUSTOMER LIST" at the start of each page as a result of the TITLE option, and only prints the item heads once on each page as a result of the TABLE modi er. For example, CUST-NO: FIRST-NAME: CUSTOMER LIST LAST-NAME: STREET-ADDR: CITY: ZIP: 22431 John Jones 5 Main Avenue Centerville 12345 34567 Mary Smith 123 4th St. Roseville 95747 The following example shows the use of the FILE= option to redirect formatted output.
END Returns control to next higher level or structure. Syntax END[modi er]; The function of the END verb depends on the modi ers used. Statement Parts To specify the impact of the END verb, use one of the following modi ers: none At the end of a command sequence, control returns to command level (the current command if the REPEAT quali er is in e ect) or to the beginning of a current level.
END Examples In this example, END terminates the command sequence and clears the program registers. $$ADD: $PROGRAM: PROMPT(PATH) PROG-NAME: VERSION: DESCRIPTION; PUT PROGRAMS, LIST=(PROG-NAME:DESCRIPTION); END; The following example terminates the program PROG1. SYSTEM PROG1; . <> . END PROG1; This example terminates processing of the level, resets the program registers to their state before to the LEVEL statement, and returns control to the LEVEL statement. LEVEL; .
EXIT Generates an exit from the Transact program to MPE or from a called Transact program to the calling Transact program. Syntax EXIT; EXIT causes control to return to the operating system from a main program. If Transact was processing a called program, control returns to the calling program where processing continues. Unlike END, EXIT does not issue the EXIT OR RESTART (E/R)? prompt.
FILE FILE Reads, writes, updates, sorts, and otherwise operates on MPE les. Syntax 2 3 FILE(modi er) le-name ,option-list ; FILE speci es operations on any MPE le de ned in the SYSTEM statement. The operations that FILE performs are determined by the following verb modi ers: CLOSE Closes the speci ed le. (See Syntax Option 1.) CONTROL Performs an FCONTROL operation. (See Syntax Option 2.) OPEN Opens speci ed le. (See Syntax Option 3.) READ Reads record from speci ed le. (See Syntax Option 4.
FILE le-name,CODE=number[,PARM=item-name[(subscript)]]; FILE(CONTROL) speci es that the FCONTROL operation designated by CODE=number is to be performed. The value of number must be an unsigned integer (See the FCONTROL intrinsic description in the MPE Intrinsics Manual for the meaning of number .) Any value supplied or returned by the FILE(CONTROL) operation uses the data register eld identi ed by PARM=item-name . The item-name may be subscripted if an array item is being referenced.
FILE le-name,LIST=(item-name1:item-name2); FILE(UPDATE) replaces the current record in the le identi ed by le-name . The record contents are de ned by item-name1 through item-name2 in the list register. (6) FILE(UPDATE) le-name,LIST=(item-name1:item-name2); FILE(WRITE) writes a single record to the le identi ed by le-name . The record contents are de ned by item-name1 through item-name2 in the list register.
FILE This example is a complete program that can be used to familiarize yourself with setting a time-out interval before a data entry statement. Note that there are two loops, one nested in the other, with time-out applied only to the second PROMPT statement.
FIND FIND Performs multiple retrievals from a le or data set. Syntax 2 FIND (modi er) 3 2 3 le-name ,option-list ; FIND executes multiple retrievals from a le or data set and places retrieved data in the data register one entry at a time. It is usually used with a PERFORM= option to execute a block of statements that processes each record retrieved.
FIND RCHAIN RSERIAL SERIAL Note le-name option-list Retrieves entries from a detail set in the same manner as the CHAIN option, only in reverse order. For a KSAM le, this operation is identical to CHAIN. Retrieves entries from a data set in the same manner as the SERIAL option, except in reverse order. If an equal match without match characters exists, Transact will convert an RSERIAL option to an RCHAIN option to improve the application's e ciency.
FIND When the LIST= option is used, only the items speci ed in a LIST= option have their match conditions applied when the items are included in the match register. When the LIST= option is omitted, items which appear in the list register and the match register have their match conditions applied. Otherwise, the match conditions for an item are ignored. The match register can be used only with the modi ers CHAIN, RCHAIN, SERIAL, or RSERIAL.
FIND then data items A, B, C, D, and D are selected. For database les, an error is returned if duplicate entries are selected. If item-nameX and item-nameY are marker items (see the DEFINE(ITEM) verb), and if there are no data items between the two on the list register, no database access is performed. (item-nameX: ) All data items in the range from the last entry through the occurrence of item-nameX closest to the top of the list register.
FIND LOCK form as de ned in the data dictionary. This order need not match the order of the data items in the list register. () A null data item list. That is, the entry or entries are read, but do not retrieve any data. Locks the speci ed le or database. The lock is active the whole time that the FIND executes. If LOCK is not speci ed and a TurboIMAGE data set is being accessed, no locking is done.
FIND SOPT Suppresses the optimization of database calls. SOPT forces Transact to re-establish its path, list, and record pointers before each record is used. Use SOPT if you are calling TurboIMAGE through the PROC or CALL verbs within a PERFORM option, or if you use the same FIND verb recursively for TurboIMAGE access. For an example of how SOPT is used, see \Examples" at the end of the FIND verb description.
FIND Meaning Status Register Value 0 The FIND operation was successful. 01 A KSAM or MPE end-of- le condition occurred. >0 For a description of the condition that occurred, refer to database or MPE/KSAM le system error documentation that corresponds to the value. STATUS causes the following with FIND: Normal multiple accesses become single. The normal rewind done by the FIND is suppressed, so CLOSE should be used before FIND(SERIAL).
FIND Automatic Suppression of Optimization Transact automatically suppresses the optimization of TurboIMAGE and KSAM calls when more than one verb accesses the same le or data set within a program. On multiple retrieval verbs, automatic suppression allows a di erent path for each access of the le or data set. This feature is always active. Automatic suppression of optimization occurs when: both a FIND verb and its PERFORM option access data set X. both a FIND verb and its PERFORM option access KSAM le Y.
FIND When a REPLACE verb is used to replace a key value other than the key in the current path. When multiple PUTs, UPDATEs, REPLACEs, or DELETEs are done within the PERFORM option procedure, and the last operation is not a delete of the current record for the multiple retrieval verb. For a multiple retrieval verb using the SERIAL or RSERIAL modi er, revisiting may occur: When a PUT verb adds a record to the data set. When a REPLACE verb update is used to replace a record in the data set.
FIND Examples In the following example of FIND, use of the STATUS option suppresses automatic error handling. The STATUS option enables you to perform a routine to control operations when an end of chain or broken chain occurs.
FIND . . DISPLAY ...; RETURN; The following example shows a method for traversing a pair of data sets organized in a tree structure. It uses a recursive routine; that is, the routine NEXT calls itself. Assume that the database TREE has the following structure: LIST PARENT: CHILD; DATA PARENT; MOVE (CHILD) = (PARENT); <> >> <
FIND When you use a PERFORM= option in a FIND (or any other le access statement that allows this option), and execute other le access statements within the PERFORM= routine, Transact creates a chain of key/argument registers to keep track of which chain you are following. Each time the program returns from a PERFORM= routine, one set of key/argument values is removed. For example: LIST PROD-NUM: PROD-CODE: DESCRIPTION; DATA(KEY) PROD-NUM; <
FIND This example shows the use of the WORKFILE option. All quali ed records have their record number written to a work le. This le will be used to retrieve records instead of the TurboIMAGE chain. This example assumes that SHIP-DATE is a sort or search item within the TurboIMAGE data set ORDER-DET. READ-FILE: LIST ORD-NO: PROD-NO: DESCRIPTION: QTY-ORD: SHIP-DATE: FIND(CHAIN) ORDER-DET, LIST=(ORD-NO:SHIP-DATE), WORKFILE, PERFORM=INCDATE; . .
FORMAT Speci es the format of information displayed by the OUTPUT verb or by an unformatted DISPLAY verb. Syntax FORMAT display-list; FORMAT speci es the format of a display and the inclusion of any character strings to enhance the display. You use it in conjunction with the OUTPUT verb or an unformatted DISPLAY verb. Use the FORMAT/OUTPUT statement combination when you want to generate a display from more than one entry in a particular data set or le.
FORMAT Statement Parts display-list formatparameters October 1996 The display list contains one or more display elds and their formatting parameters separated by a colon. The elds are separated from their formatting parameters by commas as shown below: display- eld[,format-parameter]... [:display- eld[,format-parameter]...]... If you omit display-list , the display is formatted according to the default format described earlier in this verb description.
FORMAT CENTER COL=number LINE, NOCLRF, or ROW, may a ect output due to con icting values. Valid range is 30{1025. Centers a display eld on a line. The entire eld, including leading or trailing blanks, is centered. Starts the display eld in the absolute column position speci ed by number . The rst column position is 1. Maximum is 299.
FORMAT ! ' ( Ignores the implied decimal place and replaces this character with a language de ned decimal character. Outputs the language de ned thousands separator character (numeric only). Surrounds negative values with parentheses (must be last character in the edit mask). All \other" characters, which means any character not de ned above in the list of special characters, are treated as insert characters. For example: EDIT="@@@@@@.@@" displays entered data as: @@@@@@.
FORMAT ZM MM S ZS SS T A a AA aa Displays the minute with leading blank if minute < 10. Displays the minute with leading zero if minute < 10. Displays the second with no leading blank or zero if second < 10. Displays the second with leading blank if second < 10. Displays the second with leading zero if second < 10. Displays the tenth of a second. Displays the next letter in the AM or PM sequence in uppercase. Displays the next letter in the AM or PM sequence in lowercase.
FORMAT ZM Displays the month with leading blank if month < 10. MM Displays the month with leading zero if month < 10. nM Displays the rst n letters of month name in uppercase; if n > number of letters in month name, trailing blanks are not inserted. nm Displays the rst n letters of month name in lowercase except for the rst letter, which appears in uppercase. YY Displays the last two digits in current year. YYYY Displays the current year.
FORMAT LEFT LINE[=number ] LNG=number NEED=number NOCRLF NOHEAD NOSIGN PAGE[=number ] RIGHT ROW=number SPACE[=number ] TITLE 8-70 Transact Verbs the character strings, use JOIN=0. The default is 1; valid range is 0{299. Left-justi es the data item value in the display eld. This is the default speci cation. Starts the display eld on a new line or on a line after a line skip count speci ed by number . If the print device being used can overprint and you want it to do so, you should specify LINE=0.
FORMAT TRUNCATE Truncates this display eld if a character eld over ows the end of the display line; display pound signs if eld is numeric. Right-justi es a numeric data value in the display eld and inserts leading zeros. ZERO[E]S Examples The following example uses an OUTPUT statement to retrieve information from a data set DETAIL and then display it in a format set up by the preceding FORMAT statement.
GET Moves data to the data register from a data set, le, or formatted screen. Syntax 3 2 2 3 GET (modi er) source ,option-list ; GET retrieves a single entry from a data set or KSAM or MPE le after rewinding the le or data set. It is also used to move data values into the data register from a terminal under the control of a VPLUS screen.
GET source a key value in a master set. It allows programmatic control of the result of the checking. It is the equivalent of a CHECK or CHECKNOT on a PROMPT statement. PRIMARY Retrieves the master set entry stored at the primary address of a synonym chain. The primary address is located through the key value contained in the argument register. RCHAIN Retrieves an entry from a detail set or a KSAM chain in the same manner as the CHAIN option, only in reverse order.
GET option-list The LIST option is available with or without the FORM modi er. Other options, described below, are restricted for use as speci ed. LIST=(range- The list of items from the list register to be used for the GET operation. For GET(FORM) ONLY, items in the range list list ) can be child items. If the LIST= option is omitted for GET(FORM), the list of items named in the list register, and either in the SYSTEM statement or the data dictionary for the form are used.
GET then data items A, B, C, D, and D are selected. For database les, an error is returned if duplicate entries are selected. If item-nameX and item-nameY are marker items (see the DEFINE(ITEM) verb), and if there are no data items between the two on the list register, no database access is performed. (item-nameX: ) All data items in the range from the last entry through the occurrence of item-nameX closest to the top of the list register.
GET () A null data item list. That is, accesses the le or data set, but does not retrieve any data. Options Available Without the Form Modifier ERROR=label ([item-name ]) LOCK Suppresses the default error return that Transact normally takes. Instead, branches to the statement identi ed by label , and sets the stack pointer for the list register to the data item item-name . Transact generates an error at execution time if the item cannot be found in the list register. The item-name must be a parent.
GET STATUS Suppresses the action de ned in the Chapter 7 under \Automatic Error Handling." You may want to add status checking to your code if you use this option. When STATUS is speci ed, the e ect of a GET statement is described by the 32-bit integer value in the status register: Meaning Status Register Value 0 The GET operation was successful. 01 A KSAM or MPE end-of- le condition for serial read or end-of-chain for chain read has occurred.
GET Note To ensure that the cursor will be positioned on the correct eld, you must have a one to one correspondence between the elds de ned in VPLUS. Transact determines where to position the cursor by counting the elds. FEDIT FKEY=item-name [(subscript )] Fn [(AUTOREAD)]= label FREEZE INIT STATUS WINDOW= ([ eld ,] message ) 8-78 Transact Verbs Performs the eld edits de ned in the FORMSPEC de nition immediately before displaying the form.
GET message Either a string enclosed in quotation marks that speci es the message to be displayed, or an item-name [(subscript )] within parentheses containing the message string to be displayed in the window. Examples The following example shows the use of the WINDOW option when the eld name and the message are speci ed directly. GET(FORM) FORM1, INIT, LIST=() WINDOW=(field1,"This field must be numeric.
GET This statement displays the form CUSTFORM, performs any initialization speci ed by FORMSPEC, retrieves values entered into the form, performs any FORMSPEC edits, and then transfers the entered values to the data register areas associated with the speci ed list items. GET(FORM) CUSTFORM, INIT, LIST=(CUST-NAME, CUST-ADDR, CUST-PHONE); In the following example, GET with the STATUS option allows you to process the \nonexistent permanent le" error yourself.
GET The following example shows a method for \structured programming" with VPLUS forms. Each RETURN statement passes control back to the PERFORM statement. START: DISPLAY "Start of program"; PERFORM GETINFO; DISPLAY "End of program"; EXIT; GETINFO: GET(FORM) MENU, F1=ADD, F2=UPDATE, F3=DELETE, F4=LIST, F5=START, F6=START, F7=START, F8=ENDIT; <> . . .
GO TO Transfers control to a labeled Transact statement. Syntax GO TO label; GO TO speci es an unconditional branch to the statement identi ed by label . Statement Parts label The label to which the program should branch. Example The following statement transfers control to the statement labeled \NEW-TOTAL".
IF IF Performs a speci ed action based on a conditional test. Syntax 2 3 IF condition-clause THEN statement ELSE statement ; IF speci es tests to be performed on test-variables . IF introduces a condition-clause , which contains one or more conditions, each made up of a test-variable , a relational-operator , and one or more values . Multiple conditions are joined by AND or OR. If the condition clause is true, then the speci ed statement is performed.
IF Current status of the automatic null response to a prompt set by a user responding with an exclamation point (!) to a prompt. (See \Data Entry Control Characters" in Chapter 5.) If the null response is set, the EXCLAMATION test variable is a positive integer. If it is not set, it is zero. The default is 0. FIELD Current status of FIELD command identi er. If a user quali es a command with FIELD, the FIELD test variable is a positive integer. Otherwise, it is a negative integer. The default is <0.
IF value The value against which the test-variable is compared. The value can be an arithmetic expression that will be evaluated before the comparison is made. The allowed value depends on the test variable, as shown in the comparison below. Alphanumeric strings must be enclosed in quotation marks.
IF ALPHABETIC statement This class condition includes all ASCII native language alphabetic characters (upper and lowercase) and space. This class test is only valid for items of type X or U or when the item is in the input register. ALPHABETIC- This class condition includes all ASCII lowercase native language alphabetic LOWER characters and space. This class test is only valid for items of type X or U or when the item is in the input register.
IF Examples This statement causes a program branch to the \PROCEED" label if \YES" or \Y" was input in response to the INPUT prompt. If INPUT contains any other value, control passes to the next statement. IF INPUT = "YES", "Y" THEN GO TO PROCEED; This statement causes a program branch to the \TOO-HIGH" label if the data register value for the item-name COUNT is greater than 3.
IF is displayed, and control returns to the label OPTION at the third line, so that the user is prompted again. SYSTEM IFS; DEFINE(ITEM) FIELD I(2); OPTION: PROMPT FIELD; IF (FIELD) = 1 THEN DO DISPLAY "FIELD = 1"; DOEND ELSE DO IF (FIELD) = 2 THEN DO DISPLAY "FIELD = 2"; DOEND ELSE DO DISPLAY "YOU MUST ENTER 1 OR 2"; GO TO OPTION; DOEND; DOEND; END; The next examples demonstrate how to use complex conditionals. IF (LAST-NAME) = "SMITH" AND (FIRST-NAME) = "JACK" THEN ...
IF The next examples demonstrate the use of the relational operator \<>" with multiple values. IF (STATE) <> "OR","CA","CO","VA" THEN ... WHILE (PART-NO-PREFIX) <> (PROTOTYPE),(DEVELOPMENT) GET(CHAIN) PART-DETAIL,STATUS; The next examples demonstrate the use of class conditionals. IF INPUT = ALPHABETIC THEN ... ELSE ...; DATA (PART-NUMBER); IF (PART-NUMBER) <> NUMERIC THEN ...; The next example demonstrates the use of multiple expressions in test-variables or in values .
INPUT Prompts for a value and places it in the input register. Syntax 2 3 INPUT "prompt-string" ,option-list ; INPUT generates a prompt that requests a user response. Usually the value input as a response to prompt-string is tested by a subsequent IF statement. The response can be used to programmatically change program ow during execution. Transact upshifts all entered values. The value returned by INPUT cannot be displayed or moved. Thus, INPUT is useful mainly to test a user response.
INPUT Examples This example shows a typical use of the INPUT verb. INPUT accepts a user response, and then the IF statement tests for a particular value of this response.
ITEM De nes variables for use in the program that have not been de ned in a data dictionary. The DEFINE(ITEM) verb is preferred. See DEFINE(ITEM) in this chapter for syntax option descriptions and additional information.
LET LET Speci es arithmetic operations. Syntax 2 2 2 3 33 LET destination-variable = arithmetic-expression ,ERROR=label ( item-name ) ; The LET verb is primarily used to perform arithmetic operations. Note At one time the LET verb was also used to manipulate arrays through an optional syntax variation that used the LET OFFSET option. However, the current version of Transact supports subscripting of arrays so that use of the LET OFFSET is no longer necessary.
LET STATUS arithmeticexpression An integer, de ned as I(5,,2) in Transact/V or de ned as I(10,,4) in Transact/iX, that contains the computed or assigned value of the status register. TLINE An integer, de ned as I(5,,2) in Transact/V or de ned as I(10,,4) in Transact/iX, that contains the computed or assigned value of the line counter for the current line of terminal display output. A single source, or multiple sources connected by arithmetic operators in the format: [-]source1 [operator source2 ] . . .
LET label The label to which the program is to branch when an arithmetic error is encountered. item-name The point to which the list register is to be reset before branching to the error label. If you do not specify an item-name (for example, ERROR=label () or ERROR=label ), the list register is reset to empty. If you specify an asterisk (for example, ERROR=label (*)), the list register is not changed.
LET ASCII The ASCII function converts the rst character of a string to the number for its ASCII code. The result will be a number between 0 and 255 inclusive. This function is only valid for string constants and data items of type X or U.
LET LENGTH The LENGTH function returns the length in characters of a string by returning the integer index of the position of the last non-blank character in the string. Embedded blanks are included in this count, but trailing blanks are not included. Nulls are considered valid characters and are counted. When calculating the length of an X or U item, the maximum length will be the display length. This function is only valid for string constants and data items of type X or U.
LET LN The LN function computes the natural logarithm of a number. Previously, an additional set of parentheses was not allowed around an item parameter in this function. This has been changed so that additional parentheses around an item are optional. For example, LN(A) and LN((A)) are both acceptable. Note Syntax LN( 2 3 (item-name (subscript) ) numeric-constant ) Examples LET (RESULT) = LN(100.0); RESULT R(6,2,4) Before 0.00 After 4.
LET LOG The LOG function computes the common logarithm to the base 10 of a number. Previously, an additional set of parentheses was not allowed around an item parameter in this function. This has been changed so that additional parentheses around an item are optional. For example, LOG(A) and LOG((A)) are both acceptable. Note Syntax LOG( 2 3 (item-name (subscript) ) numeric-constant ) Examples LET (RESULT) = LOG(100.0); RESULT Before R(6,2,4) 0.00 After 2.
LET POSITION The POSITION function returns the integer index of the position of the rst occurrence of the second string in the rst string. Trailing blanks in both strings are ignored. Hence, a string only consisting of blanks cannot be found. If no match is found, then 0 is returned. This function is case sensitive (for example, \a" does not match \A"). This function is only valid for string constants and data items of type X or U.
LET SQRT The SQRT function computes the square root of a number. Previously, an additional set of parentheses was not allowed around an item parameter in this function. This has been changed so that additional parentheses around an item are optional. For example, SQRT(A) and SQRT((A)) are both acceptable. Note Syntax SQRT( 3 2 (item-name (subscript) ) numeric-constant ) Examples LET (RESULT) = SQRT(100.0); RESULT Before R(6,2,4) 0.00 After 10.
LET VALUE The VALUE function returns the numerical value of a string containing the character representation of an integer or a oating point number. Leading blanks are ignored. An initial plus or minus sign is allowed. The number is then terminated by one of the following: (1) the rst character that would not be valid in the number; (2) the end of the de ned length of the item; or (3) a delimiter de ned via the SET(DELIMITER) verb.
LET LET (NUM) = VALUE(I); NUM I Before I(5) 0 I(5) 12345 After 12345 12345 LET (NUM) = VALUE("123-456"); NUM Before I(5) 0 After 123 Syntax Options (1) LET (variable)=[-]arithmetic-expression; Choose this option to place a single value or the result of an arithmetic operation into a location in the data register variable or into one of the Transact-de ned names allowed for the destination variable.
LET The LET verb is primarily used to perform arithmetic operations on numeric items. No error is generated if a character (X or U type) item is used and processing continues for that character type, but the results may not be as expected. (Use MOVE to handle character items.) Note When LET is used with character items, be aware that the display length is used to determine the size of the item.
LET Note It is strongly recommended that you address array items by using subscripts. This discussion is included for those dealing with older versions of Transact programs written before subscripting of arrays was implemented. In any case, the LET OFFSET and subscripting should not be used together. Doing so may cause the program to update the data registers in areas outside the limits of the item referenced and could lead to unpredictable results.
LET It is possible to step through a parent item using the following form of the LET statement: LET OFFSET(child-item)=OFFSET(child-item)+(byte-length-of-child-item) For example, assuming the same array SALES, you can specify the next child item as follows: LET OFFSET(YEAR) = OFFSET(YEAR) + 10 You can also use the OFFSET option of LET to manipulate complex arrays. Consider the complex array of sales gures shown in Figure 8-1. Its compound items are district, year, and month.
LET Since OFFSET leaves the pointer at the last position referenced, it is necessary to either reset the pointer before further manipulation or plan the next OFFSET in terms of the current position. The following statements reset all o sets to zero, representing the position SALES(1,1,1). LET OFFSET(DIST) = 0; LET OFFSET(YEAR) = 0; LET OFFSET(MONTH) = 0; When assigning a value to an array, LET assigns each element in the array to that value.
LET The factors that determine the method to be used are: Whether the expression consists of a single operation or multiple operations. Data types of the destination variable and the operands. The number of decimal places de ned for the destination variable and the operands. Storage length of the destination variable and the operands.
LET 64-Bit Real Arithmetic To qualify for the 64-bit (long) real method of operation, the operands must meet all of the following conditions: The expression must consist of a single operation which must be +, -, *, /, //, =, unary minus, LN, LOG, SQRT, or **. The destination variable and the operands must all be of data type R or E. Numeric constants can be used; they are converted to the type of the destination variable. The storage length of all three variables should be 32-bit or 64-bit.
LET Packed Decimal Arithmetic If the values in an expression do not meet the criteria for processing by either the 32-bit integer or 64-bit real methods, then the packed decimal method is used. In this approach, an arithmetic expression is processed according to the rules of precedence described earlier. Before computation, the data types of the destination variable and operands are converted to P - - packed P(27,0,14) - - if the operation is +, -, *, /, //, =, or unary minus.
LET Example 1 The LET statement below uses the destination variable R1, which has no decimal places. Compare the nal results with the next LET statement. LET (R1) = 11590.0000 * [[6353.6100 / 6354] * [1440/900]]; | .9999 | | | 11588.8410 | 11589 (ROUNDED) | | .9999 | 1 | | Example 2 The LET statement below uses the destination variable R2, which has ve decimal places. LET (R2) = 11590.0000 * [[6353.6100 / 6354] * [1440/900]]; | | .99993 | | 1.60000 | | 1.59989 | | 18542.72510 | | 18542.
LET The next two examples show the e ect of using either 2 or 5 digits of decimal precision on the rst example above. Example 3 Suppose the following was included in the source le: !PRECISION(2) The original LET statement assigning a value to item R1 (Example 1) is now evaluated as shown below. The major di erence from the original evaluation is that 1440/900 is treated as 1.60 rather than 1 which a ects all subsequent intermediate results. LET (R1) = 11590.0000 * [[6353.6100 / 6354] * [1440/900]]; | | .
LEVEL LEVEL De nes processing levels within a program. Syntax 2 2 3 3 LEVEL (label( item-name )) ; LEVEL speci es a new processing level. LEVEL allows repeated entries and retention of information during data entry and eliminates redundant data entry operations. The data register, key register, match register, list register, update register, SET(DELIMITER) and SET(OPTION) are unique to that level.
LEVEL Examples Nested level sequences are possible, as this example shows. The following statements minimize the data entry required for a sequence of entries for a time card. It requires values for year and month, then multiple entries for employee. Each level change provides the opportunity for the user to enter data.
LIST LIST Adds item names to list, key, match, and/or update registers. Syntax 2 3 2 LIST (modi er) item-name ,option-list 32 2 :item-name ,option-list 33 ...; LIST adds data item names to the list, key, match, and/or update registers. The register a ected depends on the verb modi er. You can choose from the following: none Adds speci ed item name to list register, reserves space, and, optionally, places value in data register. (See Syntax Option 1.
LIST Statement Parts modi er A change or enhancement to the action of LIST; often the register to which the input value should be added or the register whose value should be changed. item-name The item-name to be added or changed in the list, key, match, or update registers; must not be a child item name. option-list Values speci c to Syntax Options (1) and (3).
LIST INIT[IALIZE] Blanks if the data item type is an alphanumeric string, or binary zero for all other types. PASSWORD An X(8) item that contains the rst password value entered during Transact system log on. PROCTIME An I(9) item that contains the 32-bit integer of process CPU time in milliseconds. TERMID An I(4) item that contains the terminal logical device number. TIME An X(8) item that contains the current time in HHMMSSTT format.
LIST (3) LIST(KEY) item-name; LIST(KEY) places item-name in the key register only. (4) LIST(MATCH) item-name[,option-list]; LIST(MATCH) adds item-name to the list register and copies the existing value from the data register into the match register as a selection criterion for subsequent le or data set operations. MATCH is typically used when a previous retrieval operation has placed a value in the data register and that value is now to be used for the next selection criterion.
LIST Examples The rst example places item names NAME, ADDRESS, CITY, and DATE in the list register and reserves areas for their values in the data register. The areas for NAME, ADDRESS, and CITY are initialized to blanks and the area for DATE is initialized to the current system date in MMDDYY format. DEFINE(ITEM) NAME X(20): ADDRESS X(20): CITY X(10): DATE X(6); LIST NAME,INIT: ADDRESS,INIT: CITY,INIT: DATE,DATE; The data register is your stack.
LIST In the next example, the company code is used to retrieve and display data from one data set (CO-MSTR) and then the same value, renamed by LIST(PATH) as the department code, is used to access another data set (DEPT-MSTR).
LIST The next example shows how the DATE/C option is used. SYSTEM DATES; DEFINE(ITEM) TODAYS-DATE TODAYS-YEAR TODAYS-MONTH TODAYS-DAY X(8): X(4) = TODAYS-DATE(1): X(2) = TODAYS-DATE(5): X(2) = TODAYS-DATE(7); LIST TODAYS-DATE, DATE/C; DISPLAY "TODAY'S DATE: ":TODAYS-DATE,NOHEAD,EDIT="^^^^/^^/^^"; DISPLAY "FORMATTED DATE: ", LINE=2: TODAYS-MONTH, NOHEAD, SPACE=0: "/", SPACE=0: TODAYS-DAY, NOHEAD, SPACE=0: "/", SPACE=0: TODAYS-YEAR,.
LOGTRAN Makes the database calls needed to maintain the database log les and optionally performs database transaction locking. Syntax 2 3 LOGTRAN(modi er) base, log-message ,option-list ; LOGTRAN is used to de ne a static or dynamic logical transaction for database transaction logging or locking purposes. If this verb is to be used for database logging and recovery, several steps must rst be completed before the statement can be used.
LOGTRAN Unlocks the database locked by its corresponding LOGTRAN(BEGIN) statement. The LOGTRAN(END) statement must always be preceded by a LOGTRAN(BEGIN) statement. No other LOGTRAN(BEGIN) or LOGTRAN(END) statement referencing the same database access path can appear between a pair of LOGTRAN(BEGIN) and LOGTRAN(END) statements. The following modi ers, XBEGIN, XEND, and XUNDO, apply to Transact/iX only.
LOGTRAN base Note to roll back a transaction started by a LOGTRAN(BEGIN) statement. Also, LOGTRAN(XUNDO) cannot be called after a call has been made to LOGTRAN(XEND) for that speci c database access path. The database to be logged. It must be one of the following: $HOME This special name indicates that the home database is to be logged. Using the actual home base name in the LOGTRAN statement causes a compiler error.
LOGTRAN NOMSG STATUS Suppresses the standard error message produced as a result of a database error. It is recommended that STATUS is used with this option. Suppresses the actions de ned in Chapter 7 under \Automatic Error Handling." You will need to add code to check the value of STATUS. When STATUS is speci ed, the e ect of a LOGTRAN statement is described by the 32-bit integer value in the status register: Meaning Status Register Value 0 The LOGTRAN operation was successful.
LOGTRAN : PROC DBLOCK(BASE(CUSTOMERS), SET(NAMES), (MODE), STATUS(DB)); MOVE (CSTATUS) = STATUS(DB); IF (CSTATUS) <> 0 THEN GO TO LOCK-ERROR; LOGTRAN(XBEGIN) $HOME, (MSG); This example ends a transaction and unlocks any data sets or database locked by the corresponding LOGTRAN(XBEGIN). LOGTRAN(XEND) $HOME, "END OF DYNAMIC TXN LOGGING"; The next example shows how to end a dynamic transaction with programmer's control of locking. It assumes that the LOCK option on LOGTRAN(XBEGIN) was NOT used.
(MODE), STATUS(DB), (NUMBYTES)); MOVE (CSTATUS) = STATUS(DB); IF (CSTATUS) <> 0 THEN GO TO DBXEND-ERROR; The last example rolls back a transaction that was previously started by LOGTRAN(XBEGIN).
MOVE Places data into a speci ed data register space. Syntax MOVE (destination-variable) = source-expression; MOVE places data into the data register location speci ed by destination-variable . You should use MOVE particularly when you want to move a character string into a data register location. Unlike LET, MOVE does not check data types during the operation. If it is necessary to convert data types between the source and the destination, you must use the LET verb to do so.
[0](item-name [(subscript )]) MOVE The value in the data register location for item-name . If you include the minus sign (0), then the source value is placed in the destination eld with opposite justi cation. That is, source data that is right-justi ed is left-justi ed in the destination eld and vice versa. The item-name can be subscripted if an array item is being referenced. (See \Array Subscripting" in Chapter 3.) A programmer-de ned character string.
MOVE FILE Moves the name of the data set or le referenced by the last database, KSAM, or MPE call to the data register location speci ed by destination-variable . Special Considerations The destination-variable on the left of the \=" sign will be used as a temporary variable to hold intermediate values necessary when calculating the result of the source-expression on the right of the \=" sign.
MOVE After the move, CHILD2 contains \AAA", not \AAB", because the move is done as follows: 1. The rst A is moved from position 1 to position 3. 2. The second A is moved from position 2 to position 4. 3. The third character has already been replaced by step 1, and is now A; the third step is therefore to move A from position 3 to position 5. When a MOVE contains more than two operands, the Transact compiler will split the MOVE into multiple MOVE statements of two operands each.
MOVE CHAR The CHAR function returns the character equivalent of a numerical ASCII code. The argument is a number between 0 and 255 inclusive. Arguments outside the range of 0 to 255 will return a blank.
MOVE COL The COL function moves a string into the destination beginning at the speci ed column position. The rst column position is 1. Any bytes in the destination to the left of the column position will be unchanged. Syntax 3 2 (item-name (subscript) ) ,position) COL( "character-string" where position is either a data item name in parentheses or a numeric constant. The position parameter indicates the byte in the destination where the string will begin.
MOVE LOWER The LOWER function returns a string in which all letters are converted to lowercase. Any non-alphabetic characters remain unchanged.
MOVE PROPER The PROPER function returns a string in which a letter in the rst character position and each letter immediately following a special character are converted to uppercase. All other characters remain unchanged. The default set of special characters as used by PROPER are !"#$%&'()*+,./:;<=>?@[\]^_`{|}~ and the blank character. To change the set of characters that cause the next letter to be upshifted, see the SET and RESET verbs later in this chapter.
MOVE MOVE (LNAME) = PROPER((NAME)); NAME LNAME Before X(7) atandtb X(7) ABCDEtt After atandtb AtAndtB MOVE (ACTION(2)) = PROPER((VERB((I)))) + "ed"; I VERB(3) ACTION(2) Before I(5) 3 X(4) JUMP X(6) TURNSt After 3 JUMP JUMPed MOVE (LNAME) = PROPER("a1b,c.d!e&f g(h]i;"); LNAME 8-136 Transact Verbs Before X(18) ABCDt...t After A1b,C.
MOVE SPACE The SPACE function moves the speci ed number of spaces into the destination before moving the string. Syntax 2 3 (item-name (subscript) ) ,space-size) "character-string" where space-size is either a data item name in parentheses or a numeric constant. The space-size parameter indicates the number of spaces to be moved to the destination before moving the string.
MOVE STRING The STRING function returns a string that is taken from another string beginning at a given position for a given length. Syntax 3 2 (item-name (subscript) ) ,position,length) STRING( "character-string" where position and length are either data item names in parentheses or numeric constants. The position parameter indicates the byte at which the substring begins. The length parameter indicates the number of bytes to move.
MOVE The string function returns a null, therefore nothing is removed. MOVE (X5) = STRING ("a",20,1); MOVE (X10) = "Rapid Team" 0 (X5) X5 X10 0 "p"; Before After X(5) ABCDE ttttt X(10) XYZttttttt RaidTeamtt The string function returns a null, however when a null is moved to an X type item, it is converted to blanks. A blank is then removed in the second MOVE statement.
MOVE UPPER The UPPER function returns a string in which all letters are converted to uppercase. Non-alphabetic characters remain unchanged.
MOVE Examples The rst example copies the values for FIELD-A into FIELD-B. MOVE (FIELD-B) = (FIELD-A); FIELD-A Before X(4) SAMt After SAMt FIELD-B X(5) CHUCK SAMtt <> The next example moves the rst two characters of DATE into MONTH. MOVE (MONTH) = (DATE); DATE Before X(6) 100770 After 100770 MONTH X(2) 12 10 <> The next example shows concatenation. Note that the trailing blanks in FIELD1 are stripped when the two elds are concatenated.
MOVE The next examples show justi cations using elds of di erent lengths. MOVE (FIELDB) = 0(FIELDA); FIELDA Before X(4) XYZt After XYZt FIELDB X(8) 12345678 tttttXYZ MOVE (FIELDA) = 0(FIELDB); FIELDA Before X(4) XYZt After 1234 FIELDB X(8) 123456tt 123456tt MOVE (FIELDA) = 0(FIELDB); FIELDA Before X(4) XYZt After t123 FIELDB X(8) 123ttttt 123ttttt The following example demonstrates the use of MOVE with numeric data items of di erent lengths.
MOVE MOVE (ARRAY-X) = "abcdefgh"; <> MOVE (ARRAY-X(2)) = "ZZ"; LET (TEMP-I) = 67; MOVE (ARRAY-I) = (TEMP-I); LET (TEMP-I) = 78; MOVE (ARRAY-I(4)) = (TEMP-I); <> <> <> <> See Chapter 3 for more information on handling arrays.
OUTPUT Performs a multiple data retrieval from a le or data set and displays the data. Syntax 2 OUTPUT (modi er) 3 2 3 le-name ,option-list ; OUTPUT speci es a database or le retrieval operation. It adds each retrieved record to the data register, but only selects for output those records that satisfy any selection criteria in the match register. For each selected record, OUTPUT displays all the items in the current list register.
OUTPUT Statement Parts modi er le-name To specify the type of access to the data set or le, choose one of the following modi ers: none Retrieves an entry from a master set based on the key value in the argument register. This option does not use the match register. CHAIN Retrieves entries from a KSAM le key or a detail chain. The entries must meet any match criteria set in the match register in order to be collected.
OUTPUT be found in the list register. The item-name must be a parent. LIST=(range-list ) If you do not specify an item-name, as in ERROR=label ();, the list register is reset to empty. If you use an \*" instead of item-name , as in ERROR=label (*);, then the list register is not changed. For more information, see \Automatic Error Handling" in Chapter 7. The list of items from the list register to be used for the data retrieval portion of the OUTPUT operation.
OUTPUT example, if range-list is A:D and the list register is as shown, then data items A, B, C, D, and D are selected. For database les, an error is returned if duplicate entries are selected. If item-nameX and item-nameY are marker items, and if there are no data items between the two on the list register, no database access is performed. (See the DEFINE(ITEM) verb description.
OUTPUT LOCK dictionary. The data items are speci ed in the order of their occurrence in the physical record or form as de ned in the data dictionary. This order need not match the order of the data items in the list register. () A null data item list. Accesses the le or data set, but does not retrieve any data. Locks the speci ed le or database. The lock is active the entire time that the OUTPUT executes. If LOCK is not speci ed and a TurboIMAGE data set is being accessed, no locking is done.
OUTPUT of the record to be retrieved. With other modi ers, Transact returns the record number of the retrieved record in item-name , a 32-bit integer (I(10,,4)). SINGLE SOPT The item-name can be subscripted if an array item is being referenced. (See \Array Subscripting" in Chapter 3.) Retrieves and displays only the rst entry that satis es any selection criteria. Suppresses the optimization of database calls.
OUTPUT STATUS You can specify either ascending or descending sort order. The default is ascending order. (See the FIND verb description for a di erent processing sequence.) Suppresses the action de ned in Chapter 7 under \Automatic Error Handling." You will need to add code to check the value of STATUS, as shown in the example below.
OUTPUT The following example retrieves the entries that satisfy the match criterion LAST-NAME = "Smith" from the data set CUSTOMER, then sorts the entries according to FIRST-NAME and displays only the sorted names. LIST LAST-NAME: FIRST-NAME; MOVE (LAST-NAME) = "Smith"; SET(MATCH) LIST(LAST-NAME); FORMAT LAST-NAME: FIRST-NAME, JOIN=2; OUTPUT(SERIAL) CUSTOMER, NOCOUNT, NOHEAD, SORT=(FIRST-NAME); << Items to be displayed. >> << Sort on first name.
PATH Establishes a chained access path to a data set or a KSAM le. Syntax 2 3 PATH le-name ,option-list ; PATH uses the key and argument registers that correspond to the KSAM key for setting up chained access for the KSAM le or chained access for a detail data set. If you do not include a STATUS option in the PATH statement, the status register is set to the number of entries in the chain of a detail set. The number of entries is not returned for a KSAM le.
PATH For all options of range-list , the data items selected are the result of scanning the data items in the list register from top to bottom, where top is the last or most recent entry. (See Chapter 4 for more information on registers.) All item names speci ed must be parent items. The LIST= option has a limit of 64 individually listed item names and a limit of 255 items speci ed by a range.
PATH NOMSG 8-154 Transact Verbs (:item-nameY ) All data items in the range from the occurrence of item-nameY closest to the top through the bottom of the list register. (item-nameX, The data items are selected from the item-nameY, list register. For KSAM les, data items must be speci ed in the order ... item-nameZ ) of their occurrence in the physical record. This order need not match the order of the data items on the list register. This option incurs some system overhead.
PATH STATUS Suppresses the action de ned in Chapter 7 under \Automatic Error Handling." You will need to add code to check the value of STATUS. When STATUS is speci ed, the e ect of a PATH statement is described by the value in a 32-bit integer status register: Meaning Status Register Value 0 The PATH operation was successful. 01 A KSAM end-of- le condition occurred.
PATH PATH is required before you use the STATUS option in a database access statement because the STATUS option suppresses the usual determination of a chain head.
PERFORM PERFORM Transfers control to a labeled statement. Syntax PERFORM label; PERFORM transfers execution to the statement identi ed by label . Execution continues until one of the following is encountered: RETURN Returns control to the statement immediately following the corresponding PERFORM statement. END Speci es the end of the current processing level and returns control to the previous processing level, or to command level if no previous processing level is active within the perform block.
PROC Calls a procedure that has been placed into a segmented library le (SL) for Transact/V or compatibility mode. PROC also calls procedures from an executable library (XL) for native mode programs on Transact/iX. Syntax 2 PROC procedure-name (parameter-list) 32 3 ,option-list ; Transact/V PROC calls an MPE system intrinsic or other compiled procedure that is resident in an SL le.
PROC Another item to note is that no conversion between IEEE oating point (real) numbers and HP3000 oating point numbers is attempted. When passing parameters or data that access real numbers, the called procedure or intrinsic must be compiled with the same real number format as the main program. (See \Floating Point Formats" in Appendix B.) Statement Parts procedure-name parameter-list The name under which the procedure is listed in the SL or XL.
PROC The parameter-list may consist of any of the following: Address of a logical array containing the value of (item-name an item in the data register. Use this parameter to [(subscript )]) pass any values de ned in your program. It is up to you to make sure that the item is on a 16-bit boundary in the data register if you want to pass a 16-bit address.
PROC BYTE(item-name ) COUNT(item-name ) DECIMAL (item-name ) FILEID( le-name ) INPUT INPUTLNG ITEM(item-name ) ITEMLNG (item-name ) KEY KEYLNG POSITION (item-name ) SET(set-name ) SETLNG(set-name ) October 1996 Address of a 16-bit integer (I(5,,2)) containing the byte length of the value of the given item. Address of a 16-bit integer (I(5,,2)) containing any subitem occurrence count for the given item. A value of 1 means that the given item is not a compound type containing subitems.
PROC SIZE(item-name ) STATUS Address of a 16-bit integer (I(5,,2)) containing the byte length of the display or entry format for the given item. Address of the lower order 16 bits of the 32-bit status register set by Transact. If the STATUS parameter is NOT used, then the 32-bit status register is set to one of the condition codes generated by the called procedure (CCL, CCE, or CCG).
PROC option-list One or more of the following options can follow the parameter list, separated by commas: UNLOAD (This option is for Transact/V only.) Unloads the procedure being called following execution; that is, removes it from the Loader Segment Table. By default, Transact leaves an entry in the Loader Segment Table for each called procedure after it executes. Only use this option if you do not need the procedure again.
PROC %32 %64 Align parameter on a 32-bit boundary Align parameter on a 64-bit boundary The alignment option must precede the parameter a ected. For example, PROC GETNAME (%32(NAME)); This option takes precedence over the PROCALIGNED 16/32/64 options for the individual parameter. It is only active for the Transact/iX compiler. Under the Transact/V processor, all parameters passed on a greater than 8-bit boundary are treated as 16-bit address parameters.
PROC data type of the formal parameter of the system intrinsic). This checking of the data type is performed when the PROCINTRINSIC compiler option is speci ed. When the PROCINTRINSIC compiler option is speci ed or the DEFINE(INTRINSIC) verb is used, the numeric constant parameters are type-checked to be 16-bit integers such as I(4,,2). You can bypass this limitation by adding the procedure to the SYSINTR le or using variable parameters instead of constants.
PROC Locating Procedures Under Transact/V, there are two library search methods for resolving procedures accessed via the PROC verb. If the procedure name has not been included in a DEFINE(INTRINSIC) statement, the SL's are searched as follows: the logon group, the PUB group in the logon account, and nally, the PUB.SYS group. If the procedure name has been included in a DEFINE(INTRINSIC) statement, SL.PUB.SYS will be searched.
PROC PAGECNTL; LET (PRINTCNTL) = 1; LET (PAGECNTL) = 0; << Underline fields << CR/LF off >> >> PROC VPRINTFORM (VCOM(CUSTFORM), (PRINTCNTL), (PAGECNTL)); Note that Transact supplies the comarea location for the forms le CUSTFORM automatically through the parameter VCOM( le name). The MAP parameter sets up a bit map for an intrinsic that is type OPTION VARIABLE. The following example calls the intrinsics CREATE and ACTIVATE. (See the MPE Intrinsics Reference Manual for the syntax of these intrinsics.
PROC DEFINE(ITEM) MSG X(30): COUNT I(4): CONTROL I(4); LIST MSG : COUNT : CONTROL; MOVE (MSG) = "HELLO THERE WORLD!!"; LET (COUNT) = -19; LET (CONTROL) = 0; PROC FWRITE (#FILEID(TRANOUT), (MSG), #(COUNT), #(CONTROL)); The next example calls the database intrinsic DBCLOSE using the BASE, SET, and STATUS key-word parameters. SYSTEM TEST, BASE=CUSTOMER ("MANAGER"); DEFINE(ITEM) MODE I(2); DEFINE(INTRINSIC) DBCLOSE; .. .
PROC PARM-VALUE-1 RESERVE-1 PARM-NAME-2 PARM-TYPE-2 PARMRESULT-TYPE2 RESULT-LENGTH-2 PARM-MODE-2 UPSHIFT-2 PARM-VALUE-2 RESERVE-2 X(55) X(1) X(20) I(4) I(4) I(4) I(4) I(4) X(55) X(1) = = = = = = = = = = BRW-PARAMETERS(35): BRW-PARAMETERS(90): BRW-PARAMETERS(91): BRW-PARAMETERS(111): BRW-PARAMETERS(113): BRW-PARAMETERS(115): BRW-PARAMETERS(117): BRW-PARAMETERS(119): BRW-PARAMETERS(121): BRW-PARAMETERS(176); LIST BRW-COMAREA: BRW-PARAMETERS; LET (MAX-NUM-PARMS) = 2; LET (ACTUAL-NUM-PARMS) = 1; MOVE (PARM-
PROC user with a main menu of options. If the user enters option 1, the BRW report is executed. The PROC calls result in the BRW Report Selection menu being displayed with the name of the report requested already lled in. The user then requests the report the same as when running BRW directly. SYSTEM BRW,VPLS=MYFF(MAINMENU(SELECTION)); DEFINE(ITEM) BRW-COMAREA X(106): BRW-STATUS I(4) = BRW-ERROR I(4) = BRW-COM-LENGTH I(4) = BRW-EXEC-FILE.
PROMPT PROMPT Accepts input from the user terminal and places the supplied values into the list, data, argument, match, and/or update registers. Syntax PROMPT[(modi er)] item-name[("prompt-string")][,option-list] [:item-name[("prompt-string")][,option-list]]...; PROMPT prompts the user for values and, depending on the syntax option chosen, places the value in one or more registers. The register a ected depends on the verb modi er.
PROMPT Statement Parts modi er item-name prompt-string option-list Changes or enhances the PROMPT verb. Usually determines the register in which to place the item name and the register to which the input value should be added or the register whose value should be changed. The name of the data item to be placed in the list register and/or another register, and whose value should be added to or changed in the data register and/or another register. The item name cannot be the name of a child item.
PROMPT Meaning Status Register Value 01 User entered a \]". 02 User entered a \]]". 03 User entered one or more blanks and no non-blank characters. 04 If timeout is enabled with a FILE(CONTROL) statement, a timeout has occurred. >0 Number of characters (includes leading blanks if BLANKS option is speci ed); no trailing blanks are counted. The STATUS option allows you to control subsequent processing by testing the contents of the register with an IF statement.
PROMPT The user response to PROMPT(MATCH) can be any of the valid selection criteria described under \Responding to a MATCH Prompt" in Chapter 5. If the response is a carriage return, then all values for the data item are selected. If the response contains several values separated by connectors, only the rst value is placed in the data register space for the item. If a particular value is input, then all entries that match the associated data item are selected.
PROMPT Specifying the ALIGN option forces the item to be aligned on a 16-bit boundary in Transact/V and on a 32-bit boundary in Transact/iX. (5) PROMPT(SET) item-name [(\prompt-string")][,option-list][:item-name . . . ] . . . ; PROMPT(SET) adds the item-name to the list register and the input value to the data register only if the input value is not a carriage return. If the user responds to the prompt with a carriage return, no additions are made to the list and data registers.
PROMPT This example is a result of the above code. CUSTOMER'S NAME> CUST-ADDR> CUST-CITY> CUST-PHONE> The following example adds a new customer number to the data set and then adds transactions for that customer. It checks to make sure that the customer number entered by the user is not already in the data set and that the transactions apply to a customer number that is in the data set. $$ADD: <
PUT PUT Moves data from the data register to a le, data set, or a VPLUS form. Syntax 3 2 2 3 PUT (modi er) destination ,option-list ; PUT moves an entry from the list and data registers into a le or a data set; or it displays data in a VPLUS form. Statement Parts modi er To specify the type of access from the data set or le, choose one of the following modi ers. none Adds an entry, based on the list and data registers, into a le or a data set.
PUT option-list The LIST= option and the STATUS option are always available. The other options described below, may be used only without or only with the FORM modi er. The list of items from the list register to be used for the PUT operation. For data sets, no child items can be speci ed in the range list. For PUT(FORM) only, items in the range list can be child items. If the LIST= option is omitted with any modi er except FORM, all the items named in the list register are used.
PUT then data items A, B, C, D, and D are selected. For database les, an error is returned if duplicate entries are selected. If item-nameX and item-nameY are marker items (see DEFINE(ITEM) verb) and if there are no data items between the two in the list register, no database access is performed. (item-nameX: ) All data items in the range from the last entry through the occurrence of item-nameX closest to the top of the list register.
PUT () STATUS A null data item list. That is, accesses the le or data set, or displays the form, but does not transfer any data. Suppresses the action de ned in Chapter 7 under \Automatic Error Handling." If you use this option, you should program your own error handling procedures. When STATUS is speci ed, the e ect of a PUT statement is described by the 32-bit integer value in the status register: Meaning Status Register Value 0 The PUT operation was successful.
PUT Including the LOCK option will override the SET(OPTION) NOLOCK for the execution of the PUT verb. A database opened in mode 1 must be locked while PUT executes. For transaction locking, you can use the LOCK option on the LOGTRAN verb instead of the LOCK option on PUT if SET(OPTION) NOLOCK is speci ed. If a lock is not speci ed (for a database opened in mode 1) an error is returned. NOMSG RECNO=item-name [(subscript )] See \Database and File Locking" in Chapter 6 for more information on locking.
PUT Fn =label FREEZE INIT WAIT=[Fn ] comarea. The item-name may be subscripted if an array item is being referenced. (See \Array Subscripting" in Chapter 3.) Control passes to the labeled statement if the user presses function key n . n can have a value of 0 through 8, inclusive, where zero indicates the ENTER key. This option can be repeated as many times as necessary in a single PUT(FORM) statement.
PUT message Either a \string " in quotes that speci es the message to be displayed, or an item-name within parentheses containing the message string to be displayed in the window. The following example shows this option when the eld name and message are speci ed directly: PUT(FORM) FORM1, LIST=(A,C,E), WINDOW=(A,"Press f1 if data is correct.
PUT The next example displays a header form and then appends a form with data to the header. After appending the data form 10 times, each time with new data, the program asks the user if he wants to continue. The data to be displayed is taken from the data register; the particular items are determined by the LIST= option. In this example, the data in the data register is retrieved from a data set by the FIND statement.
PUT This example shows how the LIST=(#) option works, given a data set de ned as follows: NAME: ENTRY: CAPACITY: SUP-MASTER, MANUAL(13/12,18), DISC1; SUPPLIER(1), STREET-ADD, CITY, STATE, ZIP; 200; The statement: PUT SUP-MASTER,LIST=(#); is equivalent to the statement: PUT SUP-MASTER,LIST=(SUPPLIER,STREET-ADD,CITY,STATE,ZIP); Use PUT with the STATUS option to check for error conditions. This example writes to an over ow le and issues an error message when the data set is full.
REPEAT Repeats execution of a simple or compound statement until a speci ed condition is true. Syntax REPEAT statement UNTIL condition-clause; When REPEAT is encountered, the simple or compound statement following it is executed and then the condition-clause is tested. The condition-clause includes one or more conditions, each made up of a test-variable , a relational-operator , and one or more values . Multiple conditions are joined by AND or OR.
REPEAT FIELD Current status of FIELD command quali er. If a user quali es a command with FIELD, the FIELD test variable is a positive integer. Otherwise, it is a negative integer. The default is <0. INPUT The last value input in response to the INPUT prompt. PRINT Current status of PRINT or TPRINT command quali er.
REPEAT EXCLAMATION FIELD PRINT REPEAT SORT STATUS A positive or negative integer, or an expression. A 32-bit integer or an expression. If more than one value is given, then: The relational-operator can be only \=" or \<>". When the relational operator is \=", the action is taken if the test-variable is equal to value1 OR value2 OR . . . valuen . In other words, a comma in a series of values is interpreted as an OR.
REPEAT Parentheses can be used to control the order of precedence when conditional clauses are being evaluated. In multiple value conditions, evaluation terminates as soon as a truth value is determined. Examples The following example performs the compound statement between the DO/DOEND pair until the value of OFFICE-CODE exceeds 49. REPEAT DO GET(SERIAL) MASTER; . . .
REPLACE Changes the values contained in a KSAM or MPE record or a data set entry. Syntax 2 REPLACE (modi er) 3 2 3 le-name ,option-list ; REPLACE allows you to replace one or more records or entries in a le or data set. REPLACE uses the values in the update register as the new values for the updated entries.
REPLACE 2. Get the new values and place them in the update register or, if you are not using the update register, in the data register. Note that REPLACE always uses the values in the update register if there are any. You can get the new values from a user with a DATA(UPDATE) or PROMPT(UPDATE) statement, or you can place them directly in the update register with a SET(UPDATE) statement.
REPLACE le-name changed in a chain linked to a manual master set, the new item must exist in the associated master set. CURRENT Updates the last entry that was accessed from the le or data set. This modi er only replaces one entry, overriding the iterative capability of REPLACE. DIRECT Updates the entry stored at the speci ed record number. The entry may not be de ned as a child item.
REPLACE If the LIST= option is omitted with any modi er, all the items named in the list register are used. When the LIST= option is used, only the items speci ed in a LIST= option have their match conditions applied when the items are included in the match register. When the LIST= option is omitted, items which appear in the list register and the match register have their match conditions applied. Otherwise, the match conditions for an item are ignored.
REPLACE LOCK (item-nameX: ) All data items in the range from the last entry through the occurrence of item-nameX closest to the top of the list register. (:item-nameY ) All data items in the range from the occurrence of item-nameY closest to the top through the bottom of the list register. (item-nameX, The data items are selected from the list item-nameY, register. For databases, data items can be speci ed in any order. For KSAM and MPE ...
REPLACE the LOCK option on the LOGTRAN verb instead of the LOCK option on REPLACE if SET(OPTION) NOLOCK is speci ed. If a lock is not speci ed (for a database opened in mode 1) an error is returned. See \Database and File Locking" in Chapter 6 for more information. NOCOUNT Suppresses the message normally generated by Transact to indicate the number of updated entries. NOMATCH Ignores any match criteria set up in the match register.
REPLACE STATUS Suppresses the actions de ned in Chapter 7 under \Automatic Error Handling." Use of this option requires that you program your own error handling procedures. When STATUS is speci ed, the e ect of a REPLACE statement is described by the value in the 32-bit status register: Meaning Status Register Value 0 The REPLACE operation was successful. 01 A KSAM or MPE end-of- le condition occurred.
REPLACE Examples The rst example replaces a search item value in a master set with a new value. Before making the replacement, it makes sure that a detail set linked to the master set through CUST-NO has no entries with the value being replaced. PROMPT(PATH) CUST-NO ("Enter customer number to be changed"); FIND(CHAIN) SALES-DET, LIST=(); <> IF STATUS <> 0 THEN <
REPLACE The following example replaces each occurrence of a non-key item, ZIP, with a new value. It asks the user to enter the value to be replaced as a match criterion for the retrieval.
RESET RESET Resets execution control parameters, the match or update registers, the list register stack pointer, or delimiter values. Syntax RESET(modi er) [target]; The function of RESET depends on the verb's modi er, and the di erent modi ers determine the syntax of the statement. The allowed modi ers and the associated syntax options are: COMMAND Clears user responses from the input bu er. (See Syntax Option 1.) DELIMITER Resets delimiter values to Transact defaults. (See Syntax Option 2.
RESET (2) RESET(DELIMITER); RESET(DELIMITER) resets the delimiters used in input elds to the defaults of \," and \=". (See \Field Delimiters" in Chapter 5.) (3) RESET(OPTION) option-list ; RESET(OPTION) is used to reset any options that have been changed by means of the SET verb. It is also used to reset the match and update registers. option-list One or more of the following elds, separated by commas: AUTOLOAD Resets the AUTOLOAD option.
RESET The following commands do the same as above with a data name speci ed as form-store-list : DEFINE(ITEM) FORMLIST X(40); . . . LIST FORMLIST; MOVE (FORMLIST) = "MENU,ADDPROD,CHGPROD,DELPROD"; RESET(OPTION) FORMSTORE=((FORMLIST)); When local form storage is enabled, VPLUS automatically con gures the HP 2626A and HP 2626W terminals to use datacomm port 1 and removes the HPWORD con guration from the HP 2626W terminal.
RESET TPRINT Resets the TPRINT option. Any displays generated by the DISPLAY or OUTPUT statements and directed to the terminal are not line printer formatted. UPDATE item-list Clears the UPDATE register so you can set up new update parameters. This option can also be used to selectively delete item entries. Here is the format you would use: RESET(OPTION) UPDATE [LIST({[item-name})]; { * } If there is an entry in the update register with the speci ed name, it will be deleted.
RESET Examples This example removes all current match criteria and item update values from the match and update registers. RESET(OPTION) MATCH, UPDATE; This example resets the list register to its beginning so you can use the same area for new list items. RESET(STACK) LIST; The following examples show how to use the MATCH option to delete speci c items from the match register. The rst example sets up the match register.
RESET MOVE (NAME) = PROPER((NAME)); NAME Before X(12) 1doe'stjoe,p After 1doe'StJoe,P SET(PROPER) ". & -"; : RESET(PROPER); MOVE (LNAME) = PROPER("mr.&ms.smith-jones"); LNAME 8-204 Transact Verbs Before After X(18) Mr.tJohntSmith,jr. Mr.&Ms.
RETURN RETURN Terminates a PERFORM block. Syntax 3 2 RETURN (level) ; RETURN transfers control from a PERFORM block to another statement. RETURN is also used to return to a database access loop called with the PERFORM option. Statement Parts none level Transfers control to the statement immediately following the last PERFORM statement executed; also used to return to database access loop called with the PERFORM option.
RETURN Examples MAIN: PERFORM A; EXIT; . . A: PERFORM B; . . RETURN; B: PERFORM C; . . RETURN; C: PERFORM D; . . RETURN; D: PERFORM E; . . RETURN; E: . .
SET SET Alters execution control parameters, sets the match, update, or key registers, sets the list register stack pointer, sets up data for subsequent display on a VPLUS form, or sets alternate delimiters. Syntax SET(modi er) target; The function of SET depends on the verb's modi er, and the di erent modi ers determine the syntax of the statement. The allowed modi ers and the associated syntax options are: COMMAND Speci es Transact commands. (See Syntax Option 1.
SET lists all the subcommands associated with that command; if no command-label , it lists all the commands in the program. \input-string " Speci es possible user responses to command prompts and/or to prompts issued by PROMPT, DATA, or INPUT statements. This construct allows the program to simulate user responses to prompts. This option transfers control to and executes any command sequences speci ed by input-string . The code does not return automatically to the point from which it was called.
SET (3) SET(FORM) form [,option-list ]; SET(FORM) is used prior to another statement that actually displays the form. It can be used to transfer data to the VPLUS form bu er for subsequent display by a GET(FORM), PUT(FORM), or UPDATE(FORM) statement. It can also be used to set up window messages and eld enhancements for subsequent displays.
SET APPEND CLEAR CURSOR= eld-name j item-name [(subscript )] Appends the next form to the speci ed form, overriding any current or next form processing speci ed for the form in its FORMSPEC de nition. APPEND sets the FREEZAPP eld of the VPLUS comarea to 1. Clears the speci ed form when the next form is displayed, overriding any freeze or append condition speci ed for the form in its FORMSPEC de nition. CLEAR sets the FREEZAPP eld of the VPLUS comarea to zero.
SET item-nameY closest to the top of the list register. From that entry, the list register is scanned for item-nameX . All data items between are selected. An error is returned if item-nameX is between item-nameY and the top of the list register. Duplicate data items can be included or excluded from the range, depending on their position on the list register. For example, if range-list is A:D and the list register is as shown, then data items A, B, C, D, and D are selected.
SET WINDOW= ([ eld ], message ) Places a message in the window area of the screen and, optionally, enhances a eld in the form. The enhancement is done according to the de nition of the form in FORMSPEC. If the LIST=( ) option is in e ect, the window message overwrites any previous window messages for the form, but the eld enhancement is in addition to any eld enhancement already on the form.
SET This example is highly general. The rst PUT(FORM) statement displays whatever form is identi ed by FORMNAME and freezes that form on the screen. SET(FORM) then speci es that the value of ITEM-A is to be displayed and enhanced in the next form and also speci es a message (MESSAGE) to be issued when the next form is displayed by the subsequent PUT(FORM) statement.
SET This is a spacer page added to retain proper pagination. This is the end of the spacer page.
SET MOVE (STATE) = "CA"; SET(MATCH) LIST(STATE); MOVE (STATE) = "NM"; SET(MATCH) LIST(STATE); LET (DATE) = 010192; SET(MATCH) LIST(DATE), GE; +-----------------------------------------------+ | STATE STATE DATE | | equal to OR equal to AND greater than | | "CA" "NM" 010192 | +-----------------------------------------------+ (7) SET(OPTION) option-list ; SET(OPTION) and one or more option elds included in option-list set the Transact command options or override default execution parameters.
SET The parameters a and b specify alternate display options, where a speci es the leading prompt character, b speci es the trailing prompt character. If a is a caret, \^", then the leading prompt character is suppressed. If both a and b are omitted, the FIELD option encloses the response eld with the delimiters \>" and \<".
SET To use local form storage, you must include the FSTORESIZE parameter in the SYSTEM verb. (See the FSTORESIZE parameter in the SYSTEM verb entry in this chapter.) The RESET(OPTION) FORMSTORE statement is not required with the SET(OPTION) FORMSTORE statement. (See the explanation of the RESET(OPTION) FORMSTORE statement in the RESET verb description in this chapter. Chapter 5 contains more information about the SET(OPTION) FORMSTORE statement under \Local Form Storage".
SET the LOGTRAN verb. (See Chapter 6 for more information on locking.) The NOLOCK option is turned o when processing crosses a barrier between command sequences. Therefore, NOLOCK must be set in each command sequence to which it applies. NOLOOKAHEAD Disables look-ahead loading, which is the default option when local form storage is used. Setting the NOLOOKAHEAD option has the e ect of protecting explicitly loaded forms from being overwritten by automatically loaded forms.
SET ]] Terminates repeated execution of this command sequence and passes control to command mode regardless of the command level or subcommand level. However, if there is an active SET(OPTION) END= label statement, the block introduced by label is executed before control is passed to command mode. The list register is reset before the current command sequence is repeated. The user can enter \REPEAT" and then a command name during execution to control a loop.
SET same Transact system and level. Otherwise, Transact returns to command mode and issues an error message. If you plan to open the forms le and terminal with PROC statements, you should use a SET(OPTION) VPLS statement just before you place the terminal in block mode with a call to VOPENTERM. Reset with a RESET(OPTION) VPLS statement following the call to VCLOSETERM to return the terminal to character mode.
SET (8) SET(PROPER) \delimiter-string"; SET(PROPER) replaces the default characters that cause the next letter to be upshifted with the delimiter characters speci ed in the delimiter string. This statement is used in conjunction with the PROPER function on the MOVE verb. A maximum of 256 characters can be de ned as the delimiter-string . The double quote character (") can be made one of these delimiter characters by including 2 consecutive double quotes ("") anywhere in the delimiter-string .
SET The next statement moves the stack pointer back to the item PROD-NO and removes all items above it. If PROD-NO appears more than once in the list register, the pointer is set to the rst occurrence of this item going back down the list; that is, the item nearest the top of the list register stack.
SYSTEM SYSTEM Names the Transact program and any databases, les, or forms les that are used by the program. Syntax 2 3 SYSTEM program-name ,de nition-list ; The SYSTEM statement names the program and describes databases, les, or forms les that the program uses. It overrides the default space allocations that Transact uses. It must be the rst statement in the program. Statement Parts program-name A 1 to 6 character string of letters or digits that names the program.
SYSTEM References to data sets in bases other than the home base must be quali ed by including the name of the database in parentheses following the data set name: base-type password mode set-name(base-name) If one or more of the following three quali ers are used, they must all be enclosed in parentheses. The oating-point type speci cation for the database. The valid types are HP3000 16 and HP3000 32. HP3000 16 speci es that the database requires HP oating point format.
SYSTEM optlock Speci es whether or not optimized database locking is to be used. It can be a value of 0 or 1. The default = 0. (See Chapter 6 for more details.) 0 Tells Transact to always lock unconditionally at the database level. 1 Tells Transact to lock conditionally at the optimum level which avoids a deadlock with other Transact programs. DATA=data-length, data-count data-length data-count The maximum 16-bit word size of the data register.
SYSTEM MPE/iX Intrinsics Manual for a detailed explanation of these options and terms.) The default is OLD (old le), binary, no carriage control, and le equation permitted. A temporary MPE le de ned for WRITE access with the option TEMP is purged when Transact exits if Transact automatically opens and closes the le. However, it is not purged when Transact exits if the CLOSE verb is used programmatically. It is purged immediately whenever the FILE(CLOSE) verb is used.
SYSTEM In an MPE le or a KSAM le, you can then de ne the entire record as a parent item, and de ne individual elds as child items. This allows you to access the entire record by its parent name, and also refer to individual elds. For example: DEFINE(ITEM) RECORD ITEM1 ITEM2 ITEM3 ITEM4 LIST RECORD; X(80): X(25) = X(30) = X(15) = X(10) = RECORD(1): RECORD(26): RECORD(56): RECORD(71); GET(SERIAL) WORK, LIST=(RECORD); DISPLAY ITEM1: ITEM2: ITEM3: ITEM4; DATA(SET) ITEM1: ITEM2: ITEM3: ITEM4; . . .
SYSTEM access le-option-list OPTION=option SIGNON=\text " One of the following access modes: READ, WRITE, R/W, (read/write), UPDATE, SAVE, APPEND. The default is READ. Any of the following elds provided that they do not con ict in meaning: OLD, $STDLIST, $NEWPASS, $OLDPASS, $STDIN, $STDINDX, $NULL, ASCII, CCTL, SHARE, LOCK, NOFILE. (See FOPEN in the KSAM/3000 Reference Manual for a detailed explanation of these options and terms.
SYSTEM If not, you must name each form in the forms le. For example, assuming CUSTFORM has three forms, MENU, FORM1, and FORM2; MENU has no elds, FORM1 has 3 elds, and FORM2 has 4 elds: SYSTEM MYPROG, VPLS=CUSTFORM(MENU(), FORM1(F1,F2,F3), FORM2(F4,F5,F6,F7)); item-list A list of item names used in the program, in the order in which they appear on the VPLUS form, which is in a left to right and top to bottom direction.
UPDATE Modi es a single entry in a KSAM or MPE le or in a data set, or modi es a VPLUS form. Syntax 2 3 2 3 UPDATE (FORM) destination ,option-list ; UPDATE modi es data items that are not key search or sort items in a master or detail set entry. The item to be updated must have been retrieved by a prior FIND or GET statement. When used with the FORM modi er, UPDATE modi es and redisplays a currently displayed VPLUS form. In versions of Transact/iX A.04.
UPDATE Statement Parts FORM Causes this verb to transfer data from the data register to a VPLUS form displayed at a VPLUS compatible terminal by PUT(FORM) or GET(FORM). If the requested form is not currently displayed on the terminal, an error results. If this modi er is not speci ed, the destination must be a data set or le. destination The name of a le, data set, or form to be updated.
UPDATE All item names speci ed must be parent items when not using the FORM modi er. The options for range-list and the records or forms they update include the following: (item-name ) A single data item. (item-nameX: All the data items in the range from item-nameX item-nameY ) through item-nameY . In other words, the list register is scanned for the occurrence of item-nameY closest to the top of the list register. From that entry, the list register is scanned for item-nameX .
UPDATE (@ ) (# ) () items in the list unless they are de ned in the VPLUS form. This option incurs some system overhead. Speci es a range of all data items of le-name as de ned in a dictionary. The range-list is de ned as item-name1:item-namen for the le. Speci es an enumeration of all data items of le-name as de ned in the data dictionary. The data items are speci ed in the order of their occurrence in the physical record or form as de ned in the dictionary.
UPDATE STATUS Suppresses the actions de ned in Chapter 7 under \Automatic Error Handling." This option allows you to program your own error handling procedures. When STATUS is speci ed, the e ect of an UPDATE statement is described by the value in the 32-bit integer status register: Meaning Status Register Value 0 The UPDATE operation was successful. 01 A KSAM or MPE end-of- le condition occurred. >0 For a description of the.
UPDATE FREEZE INIT WAIT=[Fn ] key. This option can be repeated as many times as necessary in a single UPDATE(FORM) statement. Freezes the speci ed form on the screen and appends the next form to it, overriding any freeze or append condition speci ed for the form in its FORMSPEC de nition. FREEZE sets the FREEZAPP eld of the VPLUS comarea to 2. Initializes the elds in a VPLUS form to values de ned by the forms design utility FORMSPEC and perform any Init Phase processing before transferring data.
UPDATE The next example is similar, except that it allows the user to update all the entries in a chain, rather than a single entry. PROMPT(PATH) INV-NMBR ("INVOICE NUMBER"); PROMPT(MATCH) ITEM-NUM ("ITEM NUMBER"); LIST ITEM-QTY; FIND(CHAIN) ORDER-LINE, LIST=(ITEM-QTY), PERFORM=UPDATE-QTY; .. . UPDATE-QTY: DISPLAY; DATA(SET) ITEM-QTY ("Enter new quantity or press return to keep old quantity"); UPDATE ORDER-LINE, LIST=(ITEM-QTY); RETURN; The following example uses marker items to declare a range.
WHILE WHILE Repeatedly tests a condition clause and executes a simple or compound statement while the condition is true. Syntax WHILE condition-clause statement; WHILE causes Transact to test a condition-clause . The condition clause includes one or more conditions, each made up of a test-variable , a relational-operator , and one or more values ; multiple conditions are joined by AND or OR. If the result of that test is true, then the statement following the condition is executed.
WHILE relationaloperator value EXCLAMATION test variable is a positive integer; if not set, it is zero. The default is 0. FIELD Current status of FIELD command quali er. If a user quali es a command with FIELD, the FIELD test variable is a positive integer. Otherwise, it is a negative integer. The default is < 0. INPUT The last value input in response to the INPUT prompt. PRINT Current status of PRINT or TPRINT command quali er.
WHILE item-name [arithmetic expression ] An alphanumeric string, a numeric value, an arithmetic expression, a reference to a variable as in (item-name ), or a class condition as described below. A numeric value, an arithmetic expression, or an expression, or a reference to a variable as in (item-name ). INPUT An alphanumeric string. A positive or negative integer, or an EXCLAexpression. MATION FIELD PRINT REPEAT SORT STATUS A 32-bit integer or expression.
WHILE Order of Evaluation When complex conditions are included, the operator precedence is: Arithmetic expressions are evaluated. Truth values are established for simple relational conditions. Truth values are established for simple class conditions. Multiple value conditions are evaluated. Truth values are established for complex AND conditions. Truth values are established for complex OR conditions. Parentheses can be used to control the order of precedence when conditional clauses are being evaluated.
WHILE The next example sorts the entries in data set ORDER-DET in primary sequence by ORD-NO and in secondary sequence by PROD-NO. As it sorts, it passes the sorted entries to the PERFORM statements at the label DISPLAY to be displayed in sorted order. SORT-FILE: LIST ORD-NO: PROD-NO: DESCRIPTION: QTY-ORD: SHIP-DATE: FIND(SERIAL) ORDER-DET, LIST=(ORD-NO:SHIP-DATE), SORT=(ORD-NO,PROD-NO), PERFORMDISPLAY; . .
9 Running Transact A Transact program must be compiled before it can be executed. On MPE V systems, the Transact/V compiler must convert the source code into intermediate processor code (p-code) which is interpreted by the Transact/V processor at run time. On MPE/iX systems, the Transact/iX compiler generates a native mode program le. The Transact/V compiler and processor may be used in compatibility mode on MPE/iX systems.
Compiler Commands You can place any of the following commands between any two statements in the source program to control the compiled output, to conditionally compile blocks or code, or to control which data dictionary is used. Because these commands are not language statements, do not terminate them with a semicolon. Compiler Output Commands Causes the compiler to place the speci ed text-string in the rst record of the code le as a copyright notice. The text-string can be up to 500 characters long.
Conditional Compilation Commands There are 10 conditional compilation switches that can be set to ON or OFF by the !SET compiler command. The switches can then be queried by the !IF compiler command, and compilation of the following block of code will depend on the value of the switch. The end of the conditional block is marked by !ELSE or !ENDIF. The following compiler commands are used to control conditional compilation: !SET Xn ={ON/OFF} Sets the compilation switch to ON or OFF. The default is OFF.
System Dictionary Compiler Commands The default data dictionary used by Transact is Dictionary/V. If you want to access System Dictionary, use the following compiler commands: Causes the compiler to use the named System Dictionary to !SYSDIC[(dictionary.group. resolve all forms les, forms, le de nitions, and data items account )] not de ned in DEFINE statements. Defaults to SYSDIC in logon group and account.
Controlling Decimal Precision The !PRECISION compiler command is used to force a minimum number of decimal places (i.e. digits to the right of the decimal point) that will be maintained for all packed-decimal intermediate results when calculating the value of an arithmetic expression. This value is used only if the \default" evaluation method of an expression would have maintained fewer decimal places. See the discussion of rounding when using packed-decimal arithmetic under the LET verb in Chapter 8.
Program Segmentation The Transact/V compiler produces compact p-code. This p-code is placed on the process stack at execution time and therefore a ects the size of the stack. Even though the Transact p-code is compact, large programs may produce so much executable p-code that the process stack becomes too large for the operating environment. Some programs produce a p-code le so large that the process stack cannot contain the p-code. You can solve this problem by segmenting your program.
If an item is de ned in a data dictionary, but not in a DEFINE(ITEM) statement, it must be referenced in the root segment in order to be used in any segment. If the program references a child item that is de ned in the data dictionary, then the parent must be referenced either in the root segment or in the same segment as that in which the child is referenced. If you use the compile option DEFN in a segmented program, the compiler produces a list of the e ective ITEM de nitions at the end of each segment.
The Transact/V Compiler This section explains how to run the Transact/V compiler under MPE V and MPE/iX compatibility modes and describes the control options you can choose. It also describes a compiler listing, tells how you can control listings, discusses program segmentation, and describes how to control input sources to and output destinations from the compiler. Figure 9-1 illustrates the steps used to compile and run a Transact program under MPE V. Figure 9-1.
When you are running interactively at a terminal and responding to prompts, the compiler prompts for the name of the le containing the Transact source code: SOURCE FILE> Enter the le name under which the source code was saved. LIST FILE> Enter a carriage return to direct the listing to your terminal ($STDLIST). You can direct the listing to a line printer by responding with LP or you can suppress the listing altogether by responding with NULL. These are the more common responses.
OBJT OPT@ OPTE OPTH OPTI For LIST(AUTO) lename , the items are always listed right after the verb. For LIST(AUTO)@ in single segment programs, items are listed at the end of the program listing. For LIST(AUTO)@ in a multiple segment program, items are listed at the end of each segment, except that items in the root segment are listed at the end of the program. The default is NODEFN. Produces a listing of the p-code. The default is NOOBJT.
OPTP OPTS STAT XERR XREF October 1996 headings, SET(KEY) lists, and LIST= constructs. Appendix C provides additional information on this option in conjunction with data stack optimization. The default is NOOPTI. Causes Transact not to store prompt text of data items that are de ned in a data dictionary and are being used in the program to be compiled. This optimizes the tables in the p-code le so that the data segment stack is reduced at execution time.
Bypassing Transact/V Compiler Prompts Two RUN command options can be used to bypass the Transact compiler prompts. These are the PARM= and INFO= options that are speci ed in the compiler invocation statement. The PARM= option parameters identify your source le and/or list le: Value 1 Formal Designator TRANTEXT Meaning Formal le designator for source le. If speci ed, the SOURCE FILE> prompt does not appear. 2 TRANLIST Formal le designator for list le. If speci ed, the LIST FILE> prompt does not appear.
TRANTEXT is the formal le designator for the source code le. Like TRANIN, it can be le equated to the name of another le. Controlling Output Destinations from the Transact/V Compiler TRANLIST is the formal le designator for the destination of compiler listings when you set PARM=2 for the Transact compiler. When LP is the response to the LIST FILE> prompt, the default device for TRANLIST is LP. You can, however, use a le equation to change the device.
Executing Transact/V Programs This section describes how to execute Transact programs and explains how to control input to and output from the Transact processor. Transact programs are executed (the p-code is interpreted) by running the Transact processor with the MPE V RUN command: :RUN TRANSACT.PUB.SYS After an acknowledgement message, Transact issues the following prompt: SYSTEM NAME> Respond by entering the program's name as speci ed in the SYSTEM statement of the program you want to execute.
For example, suppose you want to open any databases named in your program in mode 3, and you want to execute in test mode 24 between internal locations 0 and 8. Respond to SYSTEM NAME> as follows: SYSTEM NAME> MYPROG,3,24,0,8 If the processor cannot nd a p-code le associated with the program name (\IPxxxxxx ", where \xxxxxx " is the program name), it generates an error message and reissues the SYSTEM NAME> prompt.
If a larger or smaller sort le is desired after the program has been compiled, use a le equation to change the size. This will override the settings in the SYSTEM statement. For example, to reduce the sort le size to 5,000 records, use the following MPE FILE command: :FILE TRANSORT; DISC=5000 Controlling Output Destinations from the Transact/V Processor TRANLIST is the formal le designator for the destination of processor output that is normally sent to the line printer.
A third method is to defer test mode output by setting the output priority to 1. For example: :FILE TRANDUMP; DEV=,1 :RUN TRANSACT.PUB.SYS <---priority 1 defers test mode output SYSTEM NAME> VTEST,,-34 After your program executes, you can run SPOOK5.PUB.SYS for MPE/V or a text editor for MPE/iX to examine the test mode information saved in a spool le. The Transact/iX Compiler Compiling and executing a Transact program under MPE/iX requires three sets of procedures.
Transact/iX Compiler Options Like compatibility mode TRANCOMP, the Transact/iX compiler allows you to control certain compilation features by supplying compiler options via the INFO= parameter. These options can be included on any of the commands that are used to invoke the Transact/iX compiler: TRANXL, TRANXLLK, TRANXLGO, and RUN TRAN.PUB.SYS. The Transact/iX compiler has the following options: DYNAMIC CALLS Generates dynamic calls for all CALL statements in the program.
run-time e ciency, since the compiler only generates a run-time check to ensure that these parameters are correctly aligned on a 16-bit, 32-bit, or 64-bit boundary. This option is primarily recommended for use with new Transact programs in which the correct alignment of all 16-bit, 32-bit, and 64-bit procedure parameters is assured. PROCINTRINSIC The default is NOPROCALIGNED, if PROCALIGNED 16, PROCALIGNED 32, or PROCALIGNED 64 is not speci ed.
The default is NOOPTIMIZE. TRANCOMP Options Available to the Transact/iX Compiler In addition to the compiler options described above, the Transact/iX compiler also accepts many of the compiler options available for TRANCOMP/V, described earlier in this chapter. These are: LIST ERRS CHCK DEFN OPT@ OPTH OPTE OPTP OPTI OPTS XREF The following TRANCOMP/V options are ignored by the Transact/iX compiler. Their default values are shown to the right.
The steps are shown in the following examples. Example of Static Calls with Link-Time Linking The rst example shows how to compile and run programs using static calls with link-time linking. Assume a main program called MAIN, which calls another program called PROG using static calls. First, compile the subprogram PROG into PROGOBJ using the SUBPROGRAM compiler option. :TRANXL PROG, PROGOBJ; INFO="SUBPROGRAM" Second, add the compiled program to an RL le using LINKEDIT/XL. :RUN LINKEDIT.PUB.
Dynamic Calls No special techniques or parameters are required to compile or link a Transact compiled program which uses only dynamic calls. However, the command RUN progname must include the XL = option, and an XL (the preceding example shows how to create an XL) containing all the called programs must be available at run time. Controlling Transact/iX Program Execution Both Transact/V and Transact/iX use the formal le designator, TRANIN, at run time to respond to input prompts and database passwords.
TRANDEBUG For Transact programs that were compiled with the TRANDEBUG option, this environment variable allows the user to disable and enable the TRANDEBUG debugger without recompiling the program. (See \Disabling the Debugger" in Chapter 11.) Compiling and Executing Transact/iX Programs The following MPE/iX commands are used to compile and execute Transact/iX programs: RUN TRAN.PUB.SYS Performs the same function as TRANXL but allows complete user control over all optional features.
RUN TRAN.PUB.SYS Invokes the Transact/iX compiler and produces an RSOM le. RUN TRAN.PUB.SYS [;PARM=parmnum][;INFO="text"] For complete syntax of the RUN command, see the MPE/iX Commands Reference Manual . The Transact/iX compiler is a program le called TRAN.PUB.SYS. You can therefore use the MPE/iX command RUN to invoke it and compile your program. When you compile with the RUN command, The default source, object, and listing les for the compiler are $STDIN, $NEWPASS, and $STDLIST, respectively.
TRANTEXT can be either an ASCII source le or a p-code le. When TRANTEXT contains ASCII text, TRANCOMP is called to create p-code from the source le, then it compiles the p-code. The default size of the RSOM le is 4,000 records. For very large Transact programs, you should increase the default with an MPE/iX FILE command before compiling the program.
TRANXL Invokes the Transact/iX compiler and produces an RSOM le. TRANXL [text le] [,[rl le] [,[list le]]] [;INFO = "text"] The command TRANXL invokes the Transact/iX compiler and causes it to process the speci ed source le and generate object code to a binary le. All of the parameters of the TRANXL command are optional; their default values are given below. If you do not include an optional parameter, its default value is used automatically. TRANXL does not prompt for missing parameters.
TRANXLLK Compiles and links a source le into an executable program le. TRANXLLK [text le ][,[prog le] [,[list le]]] [;INFO = "text"] The command le TRANXLLK compiles a Transact or p-code program into an RSOM le and then links that le into a program le. All of the parameters of the TRANXLLK command are optional; the default values are given below. Statement Parts text le prog le list le text The name of the input le that the Transact/iX compiler reads. This can be any p-code or ASCII le.
TRANXLGO Compiles, links, and executes a source le. TRANXLGO [text le] [,[list le]] [;INFO = "text"] The command le TRANXLGO compiles, links, and executes a Transact or p-code program. All of the parameters of the TRANXLGO command are optional; the default values are given below. After successful completion of TRANXLGO, the program le is in the temporary le $OLDPASS that you can save using the MPE/iX SAVE command.
LINK Creates an executable program le. LINK [FROM= le [, le]...] [;TO=dest le] [;RL=rl le] [;XL=xl le] [;CAP=caplist] [;STACK=maxstacksize] [;HEAP=maxheapsize] [;UNSAT=unsatname] [;PARMCHECK= integer] [;PRIVLEV=integer] [;XLEAST=integer] [;ENTRY=entryname] [;NODEBUG] [;NOSYM] [;MAP] [;SHOW] For input, the LINK command uses the RSOM le(s) produced by the Transact/iX compiler. It prepares this binary code for execution by binding procedures together and de ning the requirements for the data area.
LINKEDIT Accesses the Link Editor subsystem, where you can create program libraries and add routines to them. LINKEDIT When you compile and execute Transact/iX programs, the Link Editor is used to build subprograms and to add them to either an XL or RL. The Link Editor commands that are most likely to be used are BUILDRL BUILDXL ADDRL ADDXL For a complete description of all Link Editor commands, see the Link Editor XL Reference Manual .
RUN progname Executes the program le produced by the MPE/iX linker. RUN progname; [XL = "xlname[, xlname, ...]"] The MPE/iX RUN command executes the linked program le produced by the linker. Any external procedures referenced and stored in an executable library are bound to the program at this time. If subprograms are stored in an XL, use the XL= option to reference the library that contains the subprograms. For complete syntax and details, see the MPE/iX Commands Reference Manual .
Transact Compiler Listings The following example shows the listing of a source program produced by the compiler using all four default control options. The three columns of numbers on the left side of the listing are described below. COMPILING WITH OPTIONS: LIST,CODE,DICT,ERRS Line Number Internal Location Nesting Level 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.
The nesting level number changes at the line after the IF statement that introduces a new level. If you have trouble tracking level numbers, it helps to include DO/DOEND pairs at every level change, even though they are only required if you have compound statements. The following example shows how DO/DOEND pairs clarify the structure of a program: COMPILING WITH OPTIONS: LIST,CODE,DICT,ERRS 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 9.000 10.000 11.000 12.000 13.000 14.000 15.000 16.000 17.000 18.
DISPLAY ITEM DISPLAY ITEM Displays the value of a single item, several items, or all items in the data register. Syntax DISPLAY ITEM DIT item name list = 2 item name list 3 3 3 2 2 8 ) item12 (subscript) 32:item2 (subscript > 2 > < item12 (subscript) 3 , . . . itemN (subscript) item1 2(subscript) :3 > > : :item2 (subscript) 9 33> > = > > ; Parameters item subscript The names of the valid items or range of items in the data register that are to be displayed. These items can be child items.
DISPLAY ITEM TRANDEBUG> DISPLAY ITEM item1:item3 ITEM1: ITEM2: ITEM3: ABCD 1234 56.78 TRANDEBUG> DISPLAY ITEM ITEM1: ITEM2: ITEM3: ITEM4: ABCD 1234 56.
INITIALIZE The Transact/iX compiler does not support the INITIALIZE built-in command nor the INITIALIZE option of the SET(COMMAND) statement. To quit one program and begin another, you must EXIT from the rst program, then invoke the next program at the MPE/iX command level.
Features that Differ Between Transact/V and Transact/iX The following features di er in usage or in e ect between Transact/V and native mode Transact/iX: Multiple systems in one le Parameters passed by value or by reference in the PROC verb Parent and child values in SET(UPDATE) ALIGN option of LIST and PROMPT verbs Fill characters used for data type 9 with the MOVE verb Arithmetic operations Multiple Systems in One File The Transact/V compiler creates a separate p-code le for each SYSTEM statement in a s
Migration Examples This section contains several examples of the typical kinds of migration changes. Data File Real Number Conversion The following program shows the conversion of oating point (real) numbers from the MPE V format to the MPE/iX standard format. Note that the HP3000 16 option is applied to the input le and the HP3000 32 option is applied to the output le.
MOVE (FILE-NAME) = "OLDFILE"; LET (FOPTION) = 5; LET (AOPTION) = 0; LET (BITMAP) = 7168; PROC FOPEN(%(FILE-NAME), #(FOPTION), #(AOPTION), ,,,,,,,,,,, &(FILENUM), #(BITMAP)); <> <> <<1110000000000 passing the first>> <> <> <> To modify this source program so that it is still compatible with Transact/V, you must pass the lesize parameter and replace the two commas currently used to denote a null lesize with the lesiz
Data Area Allocation There are a few requirements for the data bu er parameter that the calling program must address. It must allocate the entire Transact/iX data register in the calling program before the call. The data bu er must be at least as large as the data register used in the subprogram. If the bu er is smaller than the amount of bytes that are placed in the LIST and DATA register in the called Transact/iX subprogram, an error message will be issued in the subprogram.
Examples The following examples illustrate how ACI is used to call a Transact/iX subprogram from a Pascal program and from a COBOL program. Pascal Code program pastest(output); $standard_level 'OS_FEATURES'$ type system_name_type = packed array[1..7] nibble = 0..15; data_record = packed record x_item : packed array[1..8] of i4_item : integer; i2_item : shortint; nine_item : packed array[1..6] of j4_item : integer; r4_item : real; packed_item: packed array[1..6] of filler : packed array[1..
Index Special characters !, 5-14, 8-37, 8-66, 8-83, 8-186, 8-237 $, 8-36, 8-66 (, 8-37, 8-67 *, 8-37, 8-66 ,, 8-37, 8-66 .
CENTER option DISPLAY verb, 8-35 FORMAT verb, 8-66 chained access path, 8-152 CHAIN modi er DELETE verb, 8-27 FIND verb, 8-51 GET verb, 8-72 OUTPUT verb, 8-145 REPLACE verb, 8-191 character mode, 5-11 CHAR function, MOVE verb, 8-132 CHCK compiler option, 9-8 CHECKNOT option DATA verb, 8-14 PROMPT verb, 8-172 CHECK option DATA verb, 8-14 PROMPT verb, 8-172 child items, 3-10 CLEAR option GET verb, 8-77 PUT verb, 8-181 SET verb, 8-210 UPDATE verb, 8-234 CLOSE modi er, FILE verb, 8-47 CLOSE verb, 8-10 closing a
REPLACE verb, 8-192 CURRENT option GET verb, 8-77 OUTPUT verb, 8-145 PUT verb, 8-181 CURSOR option PUT verb, 8-181 CURSOR option, GET verb, 8-77, 8-210, 8-234 D database closing, 6-2 data dictionary, 3-9 locking, 6-3 opening, 6-1 opening mode, 9-13 DATA BREAK DELETE command, 11-25 DATA BREAK LIST command, 11-27 DATA BREAK REGISTER command, 11-28 DATA BREAK SET command, 11-30 data dictionaries, 3-9 data entry control characters, 5-14 data le migration, B-8 data items, 3-2 adding to data register, 4-3 addin
E ! edit character, 8-66 $ edit character, 8-66 ( edit character, 8-67 * edit character, 8-66 , edit character, 8-66 . edit character, 8-66 ^ edit character, 8-66 edit characters !, 8-37, 8-66 $, 8-36, 8-66 (, 8-37, 8-67 *, 8-37, 8-66 ,, 8-37, 8-66 .
FIELD variable IF verb, 8-84 REPEAT verb, 8-186 WHILE verb, 8-238 le format conversion, B-8 FILEID parameter, PROC verb, 8-160 le locking, 6-3 le names, reserved, 9-6 FILE option, SYSTEM verb, 8-225 FILE verb, 8-47 FIND verb, 8-51, A-4 executing for a KSAM le, A-6 executing for an MPE le, A-7 executing for a TurboIMAGE data set, A-4 FKEY option GET verb, 8-78 PUT verb, 8-182 UPDATE verb, 8-234 oating point formats, B-2 FLOCK call, A-1 owcharts, A-1 Fn option GET verb, 8-78 PUT verb, 8-182 UPDATE verb, 8-234
ITEMLNG parameter, PROC verb, 8-161 ITEM modi er DATA verb, 8-14 DEFINE verb, 8-19, 8-24, 8-25 ITEM parameter, PROC verb, 8-161 ITEM verb, 8-92 J JOIN option DISPLAY verb, 8-40 FORMAT verb, 8-69 K KEYLNG parameter, PROC verb, 8-161 KEY modi er DATA verb, 8-15 GET verb, 8-72 LIST verb, 8-117 PROMPT verb, 8-173 SET verb, 8-213 KEY parameter, PROC verb, 8-161 key register, 4-4 key value, 4-4 KSAM les, 6-15 CLOSE verb, 8-10 DELETE verb, 8-27 FIND verb, 8-51 LIST verb, 8-115 OUTPUT verb, 8-144 SYSTEM verb, 8
LOGTRAN verb, 8-122 locking strategy, 6-10 look-ahead loading of forms, 5-12 LOWER function, MOVE verb, 8-134 M M and MM edit characters, 8-38, 8-67, 8-68, 8-69 MATCH modi er DATA verb, 5-8, 8-15 LIST verb, 8-118 PROMPT verb, 5-8, 8-173 SET verb, 8-213 MATCH option, RESET verb, 8-201 MATCH prompt, 5-8, 5-15 match register, 4-5 match speci cation characters, 5-15 message les, 6-21 migration checklist, B-11 examples, B-9 Transact/V data les to native mode Transact/iX, B-8 Transact/V programs to native mode
FIND verb, 8-55 GET verb, 8-76 LOGTRAN verb, 8-124 OUTPUT verb, 8-148 PATH verb, 8-152 PUT verb, 8-181 REPLACE verb, 8-195 UPDATE verb, 8-233 NOSIGN option DISPLAY verb, 8-41 FORMAT verb, 8-70 !NOSYSDIC System Dictionary command, 9-3 NOTEST option, SYSTEM verb, 8-228 NOTRAP option, PROC verb, 8-162 NULL option, DATA verb, 8-14 null parameters in Transact/iX, 8-164 null subcommand, 5-4 numeric ASCII string, 3-4 numeric parameters, 10-4 NUMERIC test value, 8-85, 8-188, 8-239 nW and nw edit characters, 8-39, 8
POSITION parameter, PROC verb, 8-161 precedence, rules of, 8-94 PRIMARY modi er DELETE verb, 8-27 FIND verb, 8-51 GET verb, 8-73 OUTPUT verb, 8-145 REPLACE verb, 8-192 PRINT command, 11-71 PRINT command quali er, 5-6 PRINT option REPEAT verb, 8-187 RESET verb, 8-201 SET verb, 8-218 PRINT variable IF verb, 8-84 WHILE verb, 8-238 PROCALIGNED 16/32/64 compiler options, 9-17 processing command sequences, 5-4 processor bypassing prompt, 9-14 input and output destinations, 9-14 redirecting VPLUS form output, 9-15
reserved words, 2-8 RESET(LANGUAGE) statement, E-1 RESET verb, 8-199 responses, user !, 8-83, 8-186, 8-237 ], 8-218 ]], 8-218 RESTART, 8-44 RESUME processor command, 5-6 RETURN verb, 8-157, 8-205 RIGHT option DATA verb, 8-14 DISPLAY verb, 8-41 FORMAT verb, 8-70 PROMPT verb, 8-172 SET verb, 8-219 rounding, 8-107 ROW option DISPLAY verb, 8-41 FORMAT verb, 8-70 RSERIAL modi er DELETE verb, 8-28 FIND verb, 8-52 GET verb, 8-73 OUTPUT verb, 8-145 REPLACE verb, 8-192 RSOM le, 9-16 rules of precedence, 8-94 RUN com
SPACE option DISPLAY verb, 8-41 FORMAT verb, 8-70 special characters, 5-14 special characters as selection criteria, 5-15 specifying language for the compiler and processor, E-2 SQRT function, LET verb, 8-101 STACK modi er RESET verb, 8-202 SET verb, 8-221 STAT compiler option, 9-10, C-6 statement labels, 2-4 statements, 2-4 compound, 2-5 formatting, 2-6 static calls, 8-2 compiling programs for, 9-19 STATUS option CALL verb, 8-5 CLOSE verb, 8-11 database and le operation verbs, 7-6 data entry verbs, 7-5 DAT
DATA verb, 8-15 LIST verb, 8-118 PROMPT verb, 8-174 TRANCODE, 9-12 TRANDBMODE, 9-21 TRANDEBUG, 9-21, 11-1 accessing MPE/iX command interpreter, 11-14 alternative debug entry points, 11-12 arithmetic traps, 11-13 compatibility, 11-3 compiling with TRANDEBUG, 11-4 continuing program execution, 11-8 Ctrl-Y, 11-8 debugging VPLUS applications, 11-11 deleting a breakpoint, 11-18 disabling, 11-12 displaying contents of input register, 11-40 displaying data items, 11-9 displaying information about a database, 11-36
Transaction Manager (XM), 6-9 Transact/iX alignment, 9-17 binding data item attributes, B-4 calling subprograms from COBOL, D-1 calling subprograms from Pascal, D-1 compiler options, 9-17 compiling programs, 9-16, 9-22 double bu ering parameters, 8-165 executing programs, 9-16, 9-22 features, B-2 INITIALIZE command, B-5 migrating to, B-1 null parameters, 8-164 option variable procedures, 8-164 test modes not supported, B-4 TRANCOMP options used, 9-19 unsupported run-time features, B-4 Transact processor err
!VERSION System Dictionary command, 9-3 VPLS option RESET verb, 8-202 SET verb, 8-219 SYSTEM verb, 8-228 VPLUS closing forms le, 8-10 forms, 5-16 GET(FORM), 5-16, 8-72 local form storage, 5-11 PUT(FORM), 5-16, 8-177 SET(FORM), 8-208 special keys, 5-16 SYSTEM verb, 8-228 TRANVPLS le, 9-15 UPDATE(FORM), 8-231 VCLOSETERM, 8-220 VOPENTERM, 8-220 VPLUS interface, 5-11 W WAIT option PUT verb, 8-182 UPDATE verb, 8-235 warning messages, 7-8 WHILE verb, 8-237 WIDTH option, SET verb, 8-220 WINDOW LENGTH command, 11