CULLUS46 counts from the first character in the string up to, but not including, the delimiter. If a delimiter is not found, the search fails and a value of -1 is returned to the designated work field.
Example 1—Using CULLUS46 Only
This example searches a 25-character input name field for the last name. The number of characters found in the last name is returned to a work field.
The following code:
INPUT 80 F 80 REC NAME-LAST-FIRST 1 25 52OUT 60 D 520 W-LEN 0 523CULLUS46 5251*010 NAME-LAST-FIRST HH 'NAME' 5251*020 W-LEN HH 'LENGTH OF LAST NAME' 527010 CALL US46 (NAME-LAST-FIRST ' ' W-LEN 25) 527020 IF W-LEN EQ -1 100 527100 $ERROR ROUTINE
REPORT NO. 52 CULLUS46 mm/dd/yy PAGE 1 NAME LENGTH OF LAST NAME JONES MARY 5 SMITH PETER 5 BROWN JACK 5 MACINTOSH JUNE 9 RICHARDS MICHAEL 8
Example 2—Using CULLUS46 Output for CULLUS45 Input
This example shows the CA Culprit parameters used to search for first and last names on input records by invoking CULLUS46 to supply the sending string length to CULLUS45 (variable-length move). CULLUS45 then moves the string to a work field.
The following code:
CULLUS45 sets the value of the sending field (ARG1) internally so that CULLUS46 can resume the character search immediately after the last character moved.
INPUT 400 F 4000 REC NAME-LAST-FIRST 225 40 530 FIRST-NAME ' ' $ LENGTH = 20 530 LAST-NAME ' ' $ LENGTH = 20 530 RANGE-LTH 0 $ RANGE LENGTH 530 SEARCH-LTH 40 $ SEARCH LENGTH . . . 537105 CALL US46 (NAME-LAST-FIRST ' ' RANGE-LTH SEARCH-LTH) 537110 IF RANGE-LTH NE -1 115 537 MOVE 19 TO RANGE-LTH 537115 RANGE-LTH A 1 RANGE-LTH 537120 CALL US45 (NAME-LAST-FIRST LAST-NAME RANGE-LTH 20 ' ') 537125 $ RESUME SEARCH AFTER MOVE OF LAST NAME 537 40 S RANGE-LTH SEARCH-LTH 537 CALL US46 (NAME-LAST-FIRST ' ' RANGE-LTH SEARCH-LTH) 537135 IF RANGE-LTH NE -1 140 537 MOVE 19 TO RANGE-LTH 537140 RANGE-LTH A 1 RANGE-LTH 537145 CALL US45 ('¢¢¢¢' FIRST-NAME RANGE-LTH 20 ' ')
Copyright © 2014 CA.
All rights reserved.
|
|