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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delim check in an UNSTRING 2

Status
Not open for further replies.

slade

Programmer
Jun 11, 2000
823
US
Hi Gang,

I’m asking this because I don’t have access to a mainframe OS390 environment and I‘m hoping someone will be kind enough to offer help. Consider the following UNSTRING stmt:
Code:
         UNSTRING IN-FLD DELIMITED
               BY ‘AQ’ OR
                  ‘A’  OR
                  ‘B’  OR
                  ‘C’
             INTO OUT-FLD-1
                  OUT-FLD-2
                  OUT-FLD-3
                  OUT-FLD-4
                  OUT-FLD-5
        
1)  Will each IN-FLD segment be searched using the 
    delimiters in the same order that they appear in
    the “delim by” phrase?  

2)  Will the fact that the 1st delim is 2 bytes 
    cause the 2nd 1 byte delim to fail the test when
    its time comes? 

I know what the results should be and what I’d like them to be, but neither of these has ever stopped  IBM from doing what it damned  well pleased in the paste.   

Here’s the “test” data:
 
If IN-FLD contains    XYZLMB1234A789AQMCMMM

Here’s what I think should happen:

Will OUT-FDL-1 contain XYZLM
     OUT-FDL-2 contain 1234
     OUT-FDL-3 contain 789 
     OUT-FDL-4 contain M
     OUT-FDL-5 contain MMM
Yes? No?

Thanx, Jack.
 
Hi Jack,

Look at this test with CA-REALIA on the PC (which is almost as good as the mainframe compiler):

Code:
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. SLADE.
000300 ENVIRONMENT DIVISION.
000400 CONFIGURATION SECTION.
000500 SOURCE-COMPUTER. IBM-PC.
000600 OBJECT-COMPUTER. IBM-PC.
000700 INPUT-OUTPUT SECTION.
000800 FILE-CONTROL.
000900 DATA DIVISION.
001000 FILE SECTION.
001100 WORKING-STORAGE SECTION.
001200 01  IN-FLD PIC X(20).
001300 01  OUT-FLD.
001400     03  FILLER    PIC X VALUE QUOTE.
001500     03  OUT-FLD-1 PIC X(10).
001600     03  FILLER    PIC X VALUE SPACE.
001700     03  OUT-FLD-2 PIC X(10).
001800     03  FILLER    PIC X VALUE SPACE.
001900     03  OUT-FLD-3 PIC X(10).
002000     03  FILLER    PIC X VALUE SPACE.
002100     03  OUT-FLD-4 PIC X(10).
002200     03  FILLER    PIC X VALUE SPACE.
002300     03  OUT-FLD-5 PIC X(10).
002400     03  FILLER    PIC X VALUE SPACE.
002500     03  OUT-FLD-6 PIC X(10).
002600     03  FILLER    PIC X VALUE QUOTE.
002700 PROCEDURE DIVISION.
002800 0001.
002900     MOVE '123AQ123' TO IN-FLD.
003000     PERFORM THE-TEST.
003100     MOVE '123A123' TO IN-FLD.
003200     PERFORM THE-TEST.
003300     MOVE '123A1A2A3' TO IN-FLD.
003400     PERFORM THE-TEST.
003500     MOVE '1A2B3CAQ1A2A3C?C??C???C' TO IN-FLD.
003600     PERFORM THE-TEST.
003700 9999.
003800     STOP RUN.
003900 THE-TEST SECTION.
004000     MOVE SPACE TO OUT-FLD-1 OUT-FLD-2 OUT-FLD-3 OUT-FLD-4
004100                   OUT-FLD-5 OUT-FLD-6.
004200     UNSTRING IN-FLD DELIMITED
004300                    BY 'AQ' OR
004400                       'A'  OR
004500                       'B'  OR
004600                       'C'
004700                  INTO OUT-FLD-1
004800                       OUT-FLD-2
004900                       OUT-FLD-3
005000                       OUT-FLD-4
005100                       OUT-FLD-5
005200     EXHIBIT NAMED IN-FLD.
005300     EXHIBIT NAMED OUT-FLD.

The results are:

Code:
IN-FLD = 123AQ123
OUT-FLD = '123        123                                                   '
IN-FLD = 123A123
OUT-FLD = '123        123                                                   '
IN-FLD = 123A1A2A3
OUT-FLD = '123        1          2          3                               '
IN-FLD = 1A2B3CAQ1A2A3C?C??C?
OUT-FLD = '1          2          3                     1                    '

Is this what you expected?
Need an other test?

Regards,

Crox
 
By the way, the results of your input are:

Code:
IN-FLD = 1234A789AQMCMMM
OUT-FLD = '1234       789        M          MMM                             '
 
something went wrong with the clipping....

other test:

Code:
IN-FLD = XYZLMB1234A789AQMCMM
OUT-FLD = 'XYZLM      1234       789        M          MM                '

so your guess was right!

Regards,

Crox
 
Hi Crox,

Thanx a million. Just what I was hoping for!

Thanx again, Jack.
 
Hi Crox,

Your Star is in the mail. Wish I could have given you 2. It really helped. Sorry I didn't do it before; I never think of them.

Thanx again, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top