Action Diagram UserPoints

877 Views


Each function type that includes an Action Diagram contains protected control logic and a set of user points unique to the function.

Synon restricts modification of the function’s logic to these user points.

It is essential that the user know the consequences of any logic that is specified in the user points.

Change Object (CHGOBJ)

USER Processing if Data Record Not Found

By default, the program context return code field (PGM.*Return code) is set to *DBF record does not exist. If necessary, insert a move at this point to set return code to *Normal.

For processing that requires the creation of a DBF record, if the record based on the input key parameters is not found, you can insert a CRTOBJ function here and use the input values of the fields passed into this function (from the PAR context) as input parameters. This is the preferred method for doing this since it involves considerably fewer I/O resources than using a RTVOBJ to read a record and the executing a CRTOBJ or CHGOBJ based on the result of the read.

USER Processing After Data Read

At this user point, data has been read from the file but not overlaid by data from incoming parameters. You can use this user point to compare for differences in the before and after images of records. You can then use this comparison to effect updates to the file.

USER Processing Before Data Update

At this user point, data has been moved from the incoming parameters to the file fields. This is often used to set a date/time stamp in the record.

USER Processing After Data Update

You can use this user point to perform updates to related files. For example, to increment totals based on the differences computed in the USER: Processing After Data Read user point.

Create Object (CRTOBJ)

USER Processing Before Data Update

Insert logic here to increment key values of records that you want to add. For example, to add records to a file with a sequential key: Retrieve the last written key value (for example, order line number) and increment it by one to obtain the key value of the next record to be written.

USER Processing if Data Record Already Exists

By default, the program context field return code (PGM.*Return code) is set to *DBF record already exists. If necessary, insert a move at this point to set the field value to *Normal.

USER Processing if Data Update Error

By default the program context field return code (PGM.*Return code) is set to *DBF update error. Insert a move at this point to set the field value to *Normal if necessary.

USER Processing after Data Update

You can use this user point to update any associated file with cumulative totals, or to automatically create extension records.

Delete Object (DLTOBJ)

USER Processing Before Data Update

CA 2E performs referential integrity checking on the data input of an application. If you want to delete data, you must perform your own checking in the action diagram. If you want to prevent the deletion of a record with references to it, insert a call here to a RTVOBJ function based on the file to be checked, (that is, any file that refers to this file). Build the RTVOBJ function over a RSQ access path that is keyed by the foreign key fields. If a record is found, set the return code to *User QUIT requested; if a record is not found, set the return code to *Normal. Check the return code; if the return code is *Normal, quit the function and send an error message if necessary.

To perform a cascading deletion of subordinate file records, insert an EXCEXTFUN function containing separate RTVOBJ function calls for each file that potentially contains records to be deleted. For each RTVOBJ, define restrictor parameters based on the higher key order of the super ordinate file. This retrieves all possible records to delete. Insert a DLTOBJ function to delete each record in the USER: Process DBF Record user point of the RTVOBJ function.

USER Processing Before Data Read

Display File (DSPFIL)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads with this user point. Implement security checking and specify an *EXIT PROGRAM action if the user is not authorized.

The program context scan limit field, PGM.*Scan limit, is set to 500 by default. If you want to change this value, do so here.

USER Initialize Subfile Control

Initialize subfile control fields from passed parameters that are not mapped or from other database file reads.

USER Initialize Subfile Record from DBF Record

Insert logic to execute further record selection processing. Set the program context field record selected to no, PGM.*Record selected = *NO for records that do not meet the criteria. This procedural level processing is useful when the majority of the records are to be selected but you do not want to build, or cannot build, the select/omit criteria into the access path. If you want all subfile records to be reprocessed after validation, insert the program context reload subfile field here (PGM.*Reload subfile = Yes).

An action to insert a *QUIT function in this user point inhibits the subfile load but does not properly condition the roll indicator.

Check for hidden fields in the subfile control as well as the operators on the subfile fields (particularly CT (contains) for alphanumeric fields) to ensure that proper records display.

Function fields of type CNT, MAX, MIN, and SUM are not allowed for this function type; however, you may want to keep running totals of subfile fields. To do this, you can add a function field to the subfile control of type USR and calculate it at subfile load time. This function type only loads a single page at a time; therefore, any calculations should be performed at the single record level or using the cumulative totals of the subfile record.

CALC Subfile Control Function Fields

Calculations associated with a derived function field are inserted in this user point.

USER Process Subfile Control (Pre-Confirm)

Insert references to function keys (using the CTL.*CMD key) here if you want to execute the function key without regard to the validity of detail screen format. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing function keys, you should place the processing in the USER: Process Command Keys user point.

Based on the results of these calls (such as adding a record), you may want to set the program context reload subfile to yes, (PGM.*Reload subfile = *YES), to refresh the panel with any changed data.

Implement checks of key processing F13 or other function keys that cause the action *EXIT PROGRAM to be executed.

CALC Subfile Record Function Fields

Calculations associated with a derived function field are inserted by CA 2E  in this user point. You can add any other actions at this user point. This user point is executed when subfile record is loaded or initialized and when it is processed as a changed record. This means that this user point is useful for activities that need to be performed at both of these times.

USER Process Subfile Record (Pre-Confirm)

Insert subfile selections (using the RCD.*SFLSEL key) here if you want to execute the subfile selections without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing subfile selections, you should place the processing in the USER: Process Command Keys user point.

Any validation for other fields on the subfile record should go here.

Same considerations as for the previous USER: Process Subfile Control (Pre-confirm).

USER Process Subfile Record (Post-Confirm)

This user point is present only if you specify the function option for a post confirm pass. You can use this user point to implement any processing on the subfile record after editing and confirmation steps.

USER Process Subfile Record (Post-Confirm Pass)

Insert logic here to implement processing for each subfile record that has been modified or flagged for additional processing.

USER Process Command Keys

This user point executes after all other processing and confirmation steps have completed. You can insert function key processing at this point or perform any operations that are related to the panel as a whole.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic is executed here whenever the F3=Exit function key is pressed or an Exit action is executed.

Display Record (DSPRCD)

Processing for the DSPRCD2 and DSPRCD3 function types is similar to DSPRCD; they differ only in the number of panels processed.

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking and specify an *EXIT PROGRAM action if the user is not authorized.

USER Load Detail Screen from DBF Record

Initialize detail fields from passed parameter fields that are not mapped or from other database file reads.

USER Process Key Screen Request

Returns processing to key panel.

CALC Detail Screen Function Fields

Calculations associated with derived function fields in the detail format appear here.

USER Validate Detail Screen

Insert references to function keys, using the CTL.*CMD key, here if you want to execute the function key. You should implement these calls before confirmation of panel processing. If you want the data record to be processed and validated prior to executing function keys, you should place the processing in the USER: Process Command Keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing F15 or other function keys that cause the action *EXIT PROGRAM to be executed.

USER Perform Confirmed Action

Insert any processing you want to occur after you press Enter.

USER Process Command Keys

This user point is always executed unless exit processing is requested (F3 in *CUAENTRY; an action in *CUATEXT). You can insert an *EXIT PROGRAM action at this point if you want to exit after DBF updates.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM action (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic is executed here whenever the F3=Exit function key is pressed or an Exit action is executed.

Display Transaction (DSPTRN)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking, and specify an *EXIT PROGRAM action if the user is not authorized.

USER Initialize Subfile Record

Initialize fields in the subfile record format, if necessary.

USER Validate Header Non-key Fields

Insert references to function keys, using the CTL.*CMD key, here if you want to execute the function key without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing function keys, you should place the processing in the USER: Process Command Keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing; F15 or other function keys that cause the action *EXIT PROGRAM to be executed.

USER Validate Header Non-key Relations

Implement subfile control field-to-field validation or other processing dependent upon prior logic.

USER Validate Subfile Record Fields

Insert references to subfile selections, using the RCD.*SFLSEL key or equivalent CUA action here if you want to execute the subfile selections without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing subfile selections, you should place the processing in the USER: Process Command Keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing F15 or other function keys that cause the action *EXIT PROGRAM to execute.

USER Validate Subfile Record Relations

Implement subfile record field-to-field validation or other processing dependent upon prior logic.

CALC Subfile Record Function Fields

Calculations associated with derived and subfile function fields (SUM, MIN, MAX, and CNT) in the subfile record appear here. You can add any actions at this user point. This user point is executed when the subfile record is loaded or initialized and when it is processed as a change record. This means that this user point is useful for activities that need to be performed at both of these times.

Although subfile function fields operate on subfile record fields, you must place them in the subfile control format of the device panel.

CALC Header Function Fields

Calculations associated with derived function fields in the subfile control appear here.

USER Validate Totals

DSPTRN, like EDTTRN, gives you an extra user point before you press Enter. This allows you to perform useful validations; in particular, relational checks between a DBF field and a function field. An example is, a comparison between a customer’s credit limit and his outstanding balance plus an order total in an Order Entry function. You can then set the program context defer confirm field to not confirm, PGM.*Defer confirm = *Do not confirm, if the validation fails and you do not want DBF updates to occur.

USER Header Update Processing

If you want to perform your own header record DBF updates, you should insert your own DBF function objects here.

USER Subfile Record Update Processing

If you want to perform your own detail record DBF updates, you should insert your own DBF function objects here.

USER Process Command Keys

This user point is always executed unless exit processing is requested (F3 in *CUAENTRY; an action in *CUATEXT). You can insert an *EXIT PROGRAM action at this point if you want to exit after DBF updates.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM action (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic is executed here whenever the F3=Exit function key is pressed or an Exit action is executed. To reload the subfile and remain in the function, you can set the program context continue transaction field to no, PGM.*Continue transaction = *NO, and insert a QUIT statement here.

Edit File (EDTFIL)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking and specify an EXIT PROGRAM action if the user is not authorized.

You can set the program context program mode field (PGM.*Program mode) to *ADD or *CHANGE. You can test this value at any time in order to perform conditional processing. If you want to change the mode in the action diagram after the panel displays, you must also set the program context reload subfile field to yes (PGM.*Reload subfile = *YES).

USER Initialize Subfile Header

Initialize subfile control fields from passed parameters fields that are not mapped or from other database file reads.

USER Initialize Subfile Record (New Record)

This user point is executed if records do not exist (PGM.*Program mode = *ADD).

USER Initialize Subfile Record (Existing Record)

This user point is executed if records exist (PGM.*Program mode = *CHANGE).

Insert logic to perform further record selection processing. Set the program context field record selected to no (PGM.*Record selected = *NO) for records that do not meet the criteria. This procedural level processing is useful when the majority of the records are to be selected but you do not want to build or cannot build the select/omit criteria into the access path.

An action to insert a QUIT function in this user point may produce unpredictable results.

Check for hidden fields in the subfile control as well as the operators on the subfile fields (particularly CT [contains] for alphanumeric fields) to ensure that proper records display.

Function fields of type CNT, MAX, MIN, and SUM are not allowed for this function type; however, you may want to keep running totals of subfile fields. To do this, you can add a function field to the subfile control of type USR and calculate it at subfile load time. This function type only loads a single page at a time; therefore, any calculations should be performed at the single record level or by using the cumulative totals of the subfile record.

CALC Subfile Control Function Fields

Calculations associated with derived function fields are inserted in this user point.

USER Validate Subfile Control

Insert references to function keys (using the CTL.*CMD key) here if you want to execute the function key without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing function keys, you should place the processing in the USER: Process Command Keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Based on the results of these calls (adding a record, for instance), you may want to set the program context reload subfile to yes (PGM.*Reload subfile = *YES) to refresh the panel with any changed data.

Implement checks of key processing (F15 or other function keys that cause the action *EXIT PROGRAM to be executed).

USER Validate Subfile Record Fields

Insert subfile selection calls to other functions using function keys that are specified in the record context subfile select field (RCD.*SFLSEL) and not in the USER: Process Command Keys user point described following.

Based upon the results of these calls (for example, zooming to change a record in a subordinate file), you may want to set the program context reload subfile field to yes, PGM.*Reload subfile = *YES, to reflect changes in the subfile records.

CALC Subfile Record Function Fields

Calculations associated with derived function fields in the subfile record appear here. You can add any other actions at this user point. This user point is executed when the subfile record is loaded or initialized and when it is processed as a change record. This means that this user point is useful for activities that need to be performed at both of these times. You may see use User: Validate Subfile Record Relations user point instead since it has a similar pattern of execution.

USER Validate Subfile Record Relations

Implement field-to-field validation or other processing that is dependent upon prior logic in this user point. This user point is executed at both the initial subfile load and at changed record processing. If you have no need of repeating changed record processing, include the logic in the Initialize Subfile Record user point instead.

If, for the purposes of validation, you do not want to execute the Update Database user points, you must set on the program context defer confirm field (PGM.*Defer confirm = *DEFER CONFIRM). Processing returns to the top of the loop that processes the panel.

USER Create Object

CA 2E  inserts object creation logic at this point if the function option for object creation is set to yes (Y).

USER Delete Object

CA 2E  inserts object deletion logic at this point if the function option for object deletion is set to yes (Y).

USER Change Object

CA 2E  inserts object modification logic at this point if the function option for object modification is set to yes (Y).

USER Extra Processing After DBF Update

Place additional action diagram logic is this user point if you have additional files that need to be updated. For instance, if you are adding a record, you may want to include additional Create Object functions for files that are not automatically linked to this file.

USER Process Command Keys

This user point is always executed unless exit processing is requested (F3 in *CUAENTRY; an action in *CUATEXT). You can insert an *EXIT PROGRAM action at this point if you want to exit after DBF updates.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM action (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic is executed here whenever the F3=Exit function key is pressed, or an Exit action is executed.

Edit Record (EDTRCD)

Processing for the EDTRCD2 and EDTRCD3 function types is similar to EDTRCD. They differ only in the number of panels processed.

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking, and specify an *EXIT PROGRAM action if the user is not authorized.

USER Initialize Detail Screen (New Record)

This user point is executed if the record does not exist, PGM.*Program mode = *ADD.

USER Initialize Detail Screen (Existing Record)

This user point is executed if record to maintain exists, PGM.*Program mode = *CHANGE. Initializes detail fields from passed parameter fields that are not mapped, or from other database file reads.

USER Process Key Screen Request

Returns processing to the key panel.

USER Delete Object

CA 2E  inserts object deletion logic at this point if the function option for object deletion is set to yes (Y).

USER Validate Detail Screen Fields

Insert references to function keys here using the CTL.*CMD key if you want to execute the function key without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want the data record to be processed and validated prior to executing function keys, place the processing in the USER: Process Command Keys user point.

If you are using some sort of preemptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing (F15 or other function keys that cause the action *EXIT PROGRAM to be executed).

You should avoid calling another function from a panel that updates the record you are maintaining since you are likely to receive the error message, Record Has Been Updated by Another User, when this function attempts a database update. This is because the record image on the database has changed since it was last saved.

CALC Detail Screen Function Fields

Calculations associated with derived function fields in the detail format appear here.

USER Validate Detail Screen Relations

Implement field-to-field validation or other processing that is dependent upon prior logic in this user point.

If, for the purposes of validation, you do not want to execute the update database user points, you must set on the program context defer confirm field, PGM.*Defer confirm = *DEFER CONFIRM. Processing returns to the top of the loop, which processes the panel.

USER Create Object

CA 2E  inserts object creation logic at this point if the function option for object creation is set to yes (Y).

USER Change Object

CA 2E  inserts object modification logic at this point if the function option for object modification is set to yes (Y).

USER Process Command Keys

This user point is always executed unless exit processing is requested (F3 in *CUAENTRY; an action in *CUATEXT). You can insert an *EXIT PROGRAM action at this point if you want to exit after DBF updates.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM action (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic is executed here whenever the F3=Exit function key is pressed, or an Exit action is executed.

Edit Transaction (EDTTRN)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking, and specify an *EXIT PROGRAM action if the user is not authorized.

USER Initialize Screen for New Transaction

This user point is executed if the header record does not exist, PGM.*Program mode = *ADD. Initialize fields in the control format, if necessary.

USER Initialize Screen for Old Transaction

This user point is executed if the header record exists PGM.*Program mode = *CHANGE. Initialize fields in the control format, if necessary.

USER Validate Header Key Fields

Executed if the program context field program mode field is Add, PGM.*Program mode = *ADD.

USER Validate Header Key Relations

Executed if the program context program mode field is Change, PGM.*Program mode = *CHANGE.

USER Load Existing Header

The existing header record format is loaded into the subfile control format.

USER Initialize Subfile Record (Old Record)

Initialize fields in the subfile record format, if necessary. This user point is executed if the program context program field is Change PGM.*Program mode = *CHANGE.

USER Initialize Subfile Record (New Record)

Initialize fields in the subfile record format, if necessary. This user point is executed if the program context program mode field is Add, PGM.*Program mode = *ADD.

USER Validate Header Non-key Fields

Insert references to function keys (using the CTL.*CMD key) here if you want to execute the function key without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing function keys, you should place the processing in the USER: Process command keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing (F15 or other function keys that cause the action *EXIT PROGRAM to be executed).

USER Validate Header Non-key Relations

Implement subfile control field-to-field validation or other processing dependent upon prior processing logic.

USER Validate Subfile Record Fields

Insert references to subfile selections here (using the RCD.*SFLSEL key or equivalent CUA action) if you want to execute the subfile selections without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing subfile selections, you should place the processing in the USER: Process command keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of key processing (F15 or other function keys that cause the action *EXIT PROGRAM to be executed).

USER Validate Subfile Record Relations

Implement subfile record field-to-field validation or other processing dependent upon prior logic.

CALC Subfile Record Function Fields

Calculations associated with derived and subfile function fields (SUM, MIN, MAX, and CNT) in (or which operate on) the subfile record appear here. You can add any other actions at this user point. This user point is executed when the subfile record is loaded or initialized and when it is processed as a new change record. This means that this user point is useful for activities that need to be performed at both of these times.

Although subfile function fields operate on subfile record fields, you must place them in the subfile control format of the device panel.

CALC Header Function Fields

Calculations associated with derived function fields in the subfile control appear here.

USER Validate Totals

EDTTRN provides you with an extra user point before the DBF update user points. This user point allows you to perform useful validations, in particular, relational checks between a DBF field and a function field. For example, a comparison between a customer’s credit limit and his outstanding balance plus an order total in an Order Entry function. You can then set the program context defer confirm field to do not confirm (PGM.*Defer confirm = *Do not confirm) if the validation fails and you do not want DBF updates to occur.

USER Create Header DBF Record

CA 2E inserts default object creation logic if the transaction creation function option is set to yes (Y).

USER Change Header DBF Record

CA 2E inserts default object modification logic if the change transaction function option is set to yes (Y). You may substitute for this, which would be useful in the event where the header format is output only (determined by you) and you want to suppress the header record. Replace the Change object function at this point with a dummy internal function that performs no essential function.

USER Delete Header DBF Record

CA 2E inserts default object deletion logic if the transaction deletion option is set to yes (Y).

USER Create Detail DBF Record

CA 2E inserts default object creation logic if the detail line creation function option is set to yes (Y).

USER Change Detail DBF Record

CA 2E inserts default object modification logic if the change transaction function option is set to yes (Y).

EDTTRN updates all records in the subfile, whether you have changed them or not.

USER Delete Detail DBF Record

CA 2E inserts default object deletion logic if the detail line object deletion function option is set to yes (Y).

USER Process Detail Record

If you have substituted dummy functions for any of the DBF updates, you want to insert your own DBF objects at this point.

USER Process Command Keys

This user point is always executed unless exit processing is requested (F3 in *CUAENTRY; an action in *CUATEXT). You can insert an *EXIT PROGRAM action at this point if you want to exit after DBF updates.

USER Exit Program Processing

Insert function key processing with a user-specific return code to execute an *EXIT PROGRAM action (F3 in *CUAENTRY; an action in *CUATEXT). The *EXIT PROGRAM logic will be executed here whenever the F3=Exit function key is pressed, or an Exit action is executed. To reload the subfile and remain in the function, you can set the program context continue transaction field to no (PGM.*Continue transaction = *NO) and insert a QUIT statement here.

Print File (PRTFIL) - Print Object (PRTOBJ)

USER Initialize Program

Initialize work fields from passed parameter fields, constants or other database file reads.

USER Record Selection Processing

Implement further logic to restrict records that are to be printed. Set the program context record selected field to no (PGM.*Record selected = *NO) to prohibit records from being printed. This should not be done as the primary means of record selection (use select/omit criteria on the access path instead) but rather to filter out based on some functional criteria, a small percentage of the records that you want to exclude from the access path.

USER Process Top of Page

This format is only available for PRTFIL.

USER Null Report Processing

This user point is executed if no records exist to print on the report.

USER On Print of File nnn Key xxx Format

For each field in the key of the access path over which the function is built there is a format to print the required level headings for the key field (control break). Each format has user points to total and format fields before, during, or after the format print.

Print object calls are placed immediately before or after the On Print user point.

USER On Print of Detail Format

CA 2E  formats fields from the DB1 file context into the Current (CUR) context of the format.

USER On Print of End of Report Format

This format is only available for PRTFIL.

Prompt and Validate Record (PMTRCD)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking and specify an *EXIT PROGRAM action if the user is not authorized.

USER Load Screen

Format the detail panel from parameters, shipped file (PGM or JOB) values, or reads to other database files.

USER Process Command Keys

Insert calls to other functions using the functions keys that are specified in the control context function key field (CTL.*CMD key).

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

Implement checks of pre-emptive key processing in a user point (F15 or other function keys in *CUAENTRY; an action in *CUATEXT) that execute an *EXIT PROGRAM action.

USER Validate Fields

If you use PMTRCD as a sub-menu, you normally have a function field of type USR on the panel that allows you to enter valid options. You may also have other USR type fields to process information that is validated against the database. Implement any validation, including existence checking, on these fields in this user point.

CALC Screen Function Fields

Calculations associated with a derived function field are inserted in the subfile record at this point.

USER Validate Relations

Check for field dependencies: the value of one field is conditioned on the value of another field(s); for example, a range where the first number must be less than or equal to the second.

USER User Defined Action

If your PMTRCD is a sub-menu, insert calls to appropriate functions based on user-entered data at this point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check relevant return codes facilitating this processing upon return from any called functions.

USER Exit Program Processing

Place pre-emptive key processing requiring exit processing (F3 in *CUAENTRY; an action in *CUATEXT) to execute an *EXIT PROGRAM action with a user-specific return code since this user point is always executed when exit is requested.

Retrieve Object (RTVOBJ)

USER Initialize Routine

Unless reading a single record for existence checking or retrieving values, much of your processing is specified from within the calling function itself. In this user point, you should initialize work fields, counters, and calculation fields.

USER Processing if Data Record Not Found

The program context return code field is set to *Record Does Not Exist. In many instances this is the default processing; however, you should set the return code field to *Normal. Do this with a move statement.

It is good practice to insert a *MOVE ALL built-in function specifying (CON.*BLANKS) if any data is retrieved by the RTVOBJ function.

If user logic exists in this user point and the record is not found, then user logic in USER: Exit processing is ignored.

USER Process Data Record

When reading for a single record with a partially restricted key, you must insert a *QUIT statement in this user point when you have found the requested record. If you are performing an existence check, you should insert a *QUIT statement once you have found the record since you do not want to read the entire file. DB1 fields must be moved to the PAR context to return field values to the calling function. If your fields match, you can use the *MOVE All statement to execute this. You must explicitly format other fields with a *MOVE statement. The parameters for which you want to return field values must be specified as O (Output) or B (Both) parameters.

When reading with a fully restricted key, if the record is found and there is no user logic in this user point, processing stops. You must have user logic in this user point if you want to read more than one record.

RTVOBJ is often used to direct a batch process. Insert any functions in this user point that are required to implement your processing: EXCEXTFUN, EXCINTFUN, CHGOBJ, CRTOBJ, and other RTVOBJ.

USER Exit Processing

You may have defined work fields that store data values while the next record is being processed. This user point is executed when processing has completed. Use the DB1 context carefully in this user point since you have not read another record and unpredictable results may occur.

User logic in this user point is not executed if user logic exists in user point USER: Processing if Data Record Not Found and no record is found.

Select Record (SELRCD)

USER Initialize Program

Initialize work fields from passed parameters or from other database file reads. Implement security checking and specify an *EXIT PROGRAM action if the user is not authorized.

The program context field *Scan Limit (PGM.*Scan Limit), which is used for establishing the number of records to read, is set to 500 by default. If you want to change this value, do so here.

USER Load Subfile Record from DBF Record

You can insert function field processing at this point, such as field and file descriptions that are accessed using a RTVOBJ to another file.

USER Process Subfile Control

Insert references to function keys (using the CTL.*CMD key) here if you want to execute the function key without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing function keys, you should place the processing in the USER: Process command keys user point.

If you are using some sort of pre-emptive function control or fast path processing, be sure to check the relevant return codes facilitating this processing upon return from any called functions.

Based on the results of these calls (adding a record, for instance), you may want to set the program context reload subfile field to yes (PGM.*Reload subfile = *YES) to refresh the panel with any changed data.

Implement checks of key processing (F15 or other function keys that cause the *EXIT PROGRAM action to be executed).

USER Process Selected Line

The function exits at this point if you have selected a subfile record.

USER Process Changed Subfile Record

If relevant, insert subfile selections (using the RCD.*SFLSEL key) here if you want to execute the subfile selections without regard to the validity of subfile records. You should implement these calls before confirmation of panel processing. If you want subfile data records to be processed and validated prior to executing subfile selections, you should place the processing in the USER: Process Command Keys user point.

Similar considerations as for DSPFIL.

CALC Screen Function Fields

Calculations associated with a derived function field are inserted in this user point.

USER Process Command Keys

This user point is always executed unless the function key or action associated with the *Exit field is requested.

USER Exit Program Processing

Place pre-emptive key processing requiring exit processing (F3 in *CUAENTRY; an action in *CUATEXT) to execute an *EXIT PROGRAM action with a user-specific return code here since this user point is always executed whenever exit processing is requested.

Post Comments