Sponsored Links
Sponsored Link

sponsored links

Collapse

Announcement

Collapse
No announcement yet.

%CHECKR and %TRIM

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • %CHECKR and %TRIM

    I can't for the life of me figure this one out...

    I am trying to do a %CHECKR for the last blank on a %TRIM'd field, but it returns the position of the end of the field. Whereas a %LEN on the same field %TRIM()'d returns the expected result, so it can't be the field..? Running V7.1 of the O/S.

    Here are the values from debug;

    Code:
    EVAL #errormsg                                                        
    #ERRORMSG =                                                            
              ....5...10...15...20...25...30...35...40...45...50...55...60
         1   'Record 91 in use by job 363082/XRDK/QPADEV002R.             '
        61   '                    '                                        
    
    EVAL #NumStart
    #NUMSTART = 48.
    
    EVAL #msglength
    #MSGLENGTH = 46.
    Here are some code snippets;
    Code:
    D PSDS           SDS              
    D  PROG                   1     10
    D  ERRORMSG              91    170
    D  JOBNAM               244    253
    D  USER                 254    263
    
    D  #ErrorMsg      S             80a  
    D  #NumStart      S              2p 0
    
    // Set start positions                          
       #ErrorMsg = ERRORMSG;      
    
       #NumStart = %CheckR(' ':%TRIM(#ErrorMsg)) + 1;
    
    // Get length of message minus full stop    
       #MsgLength = %LEN(%TRIM(#ErrorMsg)) - 1 ;


    I can work around this but I would've expected it to work... Unless I've misunderstood something?

  • #2
    Ok - I've misunderstood what %CHECKR does, it's not looking for ' ' it's looking for anything but ' ', oops.

    Comment


    • #3
      Use %ScanR() instead of %CheckR()

      Birgitta

      Comment


      • #4
        Wow, that never came up in any of my searches!!! Only %SCAN, %CHECK and %CHECKR were mentioned


        I just used %SCAN for 'job ', unfortunately the programs been tested and is offski now.


        Thanks for the info though, duly noted for next time!

        Comment

        sponsored links

        Collapse

        Working...
        X