Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting: handling of blank or nil entries by "ENTER" 1

Status
Not open for further replies.

Calator

Programmer
Feb 12, 2001
262
0
0
AU
Problem: in the scripting language < KEY ENTER variable !TO MIMS-field> apparently does not update the MIMS-field if &quot;variable&quot; is blank?

I need to update the field in MIMS with whatever is in the input variable, including spacing out existing information in MIMS, if the input variable is nil.

Can anyone advise how this can be achieved on a field-by-field basis (do not wish to use CLEAR which clears entire screen).

More details:

I am writing a script to maintain MSM685-Fixed Asset Depreciation. We wish to:
- clear all fields related to &quot;Depreciation Method&quot; or unconditionally enter the values from the input file, including nil values
- while remaining fields such as capital value, revalue amoounts, etc must only be changed if a value is present in the input file; if the field at input is blanks, do not change it in MIMS

Therefore we do NOT wish to use CLEAR as this would space out all the fields on the screen.

I am looking in particular at following 2 fields:
Manual Depreciation Rate and Manual Depreciation Final Period

I have found that my code will update these fields in MIMS if they have some values, but DOES not space out the MIMS fields if the input fields are NIL or spaces in the csv file.

I coded as following:

SUBROUTINE READ_INPUT
SET 'ROUTINE_NAME=READ_INPUT'
IMPORT FILE (INPUT_FILE) FORMAT (CSV) EXTRACT
SET 'OPTION=' CSV_1
SET 'EQUIP=' CSV_2
SET 'ASSET=' CSV_3
SET 'SUB_ASSET=' CSV_4
SET 'BK_TX=' CSV_5
SET 'DESC=' CSV_6
SET 'DEPR_METH=' CSV_7
SET 'DEPR_RATE=' CSV_8
SET 'ACCEL_RATE=' CSV_9
SET 'ACCEL_PER=' CSV_10
SET 'MAN_RATE=' CSV_11
SET 'MAN_PER=' CSV_12


....

SUBROUTINE MSM685C_KEY_DATA MSM685C
SET 'ROUTINE_NAME=MSM685C_KEY_DATA'
SYSTEM 'ECHO Entering Data for Asset: ' ASSET {BL 12} EQUIP {BL 30}
KEY
. !ENTER DEPR_METH !TO @DEPR_METHOD3I
. !ENTER DEPR_RATE !TO @DEPR_RATE3I
. !ENTER ACCEL_RATE !TO @ACCEL_DEPR_RT3I
. !ENTER ACCEL_PER !TO @FIN_ACCEL_PER3I
. !ENTER MAN_RATE !TO @MAN_PER_DEPR3I
. !ENTER MAN_PER !TO @FIN_MAN_PER3I
. !ENTER RATE_TABLE !TO @RATE_TABLE3I
. !ENTER RECOV_PER !TO @RECOV_PERIOD3I
. !ENTER DIVIDEND_ST !TO @DIVIDEND_STAT3I
. !ENTER DIVISOR_ST !TO @DIVISOR_STAT3I
. !IF EST_LIFE !ENTER EST_LIFE !TO @EST_MM_LIFE3I
. !ENTER LIFE_GRP !TO @LIFE_GRP_CODE3I
. !IF FRGN_CURR !ENTER FRGN_CURR !TO @FOREIGN_CURR3I
. !IF FRGN_AMT !ENTER FRGN_AMT !TO @FOR_CURR_AMT3I
. !IF CAP_DATE !ENTER CAP_DATE !TO @CAPITAL_DATE3I
. !IF REVAL_DATE !ENTER REVAL_DATE !TO @REVAL_DATE3I
. !IF ACC_DEP_PRV_YR !ENTER ACC_DEP_PRV_YR !TO @ACCUM_DEP_PREV3I
. !IF ACC_DEP_CRT_YR !ENTER ACC_DEP_CRT_YR !TO @ACCUM_DEP_THIS3I
. !IF EST_DISP_VAL !ENTER EST_DISP_VAL !TO @EST_DISPOS_VAL3I
. !IF CAP_COST !ENTER CAP_COST !TO @CAPITAL_COST3I
. !IF REVAL_AMT !ENTER REVAL_AMT !TO @REVAL_AMT3I
. !SEND
RETURN
 
A field can be cleared by entering a space value (rather than a null). For example:

Code:
. !IF      MAN_RATE !ENTER MAN_RATE   !TO @MAN_PER_DEPR3I
. !IF !NOT MAN_RATE !ENTER ' '        !TO @MAN_PER_DEPR3I
 
Thanks. Your help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top