IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Check field for spaces in Easytrieve program


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
coxdavi

New User


Joined: 12 Mar 2009
Posts: 30
Location: usa

PostPosted: Wed Sep 16, 2009 3:08 am
Reply with quote

For a 25-character field, I do the following check for each character:

Code:
IF CHARS1 NOT SPACE           
    MOVE CHARS1 TO CHAR31     
        ELSE                 
    MOVE '>' TO CHAR31       
    MOVE ' ' TO CHAR32       
    MOVE ' ' TO CHAR33       
    MOVE ' ' TO CHAR34       
    PUT TEMP3     
    GOTO WRAPPER   
END-IF   


The field is 25 characters of either alpha or space. When I get the first space, I move the > into that corresponding output character and move spaces into the rest of the output characters, until I fill character 25. Is there a better way to accomplish this ?

Thanks in advance for any assistance.

Dave
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 16, 2009 3:25 am
Reply with quote

Hello,

It may help if you post the field definitions as well. . .

I'm confused by char31, 32, etc if the length is only 25. . .
Back to top
View user's profile Send private message
coxdavi

New User


Joined: 12 Mar 2009
Posts: 30
Location: usa

PostPosted: Wed Sep 16, 2009 3:32 am
Reply with quote

The input file:

Code:
FILE TEMPX                           
     USERIDX   1 7 A                 
     EMADDRS 10 25 A                 
     CHARS1  EMADDRS       1 A       
     CHARS2  EMADDRS  +1   1 A       
     CHARS3  EMADDRS  +2   1 A       
     CHARS4  EMADDRS  +3   1 A       
     CHARS5  EMADDRS  +4   1 A       
     CHARS6  EMADDRS  +5   1 A       
     CHARS7  EMADDRS  +6   1 A       
     CHARS8  EMADDRS  +7   1 A       
     CHARS9  EMADDRS  +8   1 A       
     CHARS10 EMADDRS  +9   1 A       
     CHARS11 EMADDRS  +10  1 A       
     CHARS12 EMADDRS  +11  1 A       
     CHARS13 EMADDRS  +12  1 A       
     CHARS14 EMADDRS  +13  1 A       
     CHARS15 EMADDRS  +14  1 A       
     CHARS16 EMADDRS  +15  1 A       
     CHARS17 EMADDRS  +16  1 A       
     CHARS18 EMADDRS  +17  1 A
     CHARS19 EMADDRS  +18  1 A
     CHARS20 EMADDRS  +19  1 A
     CHARS21 EMADDRS  +20  1 A
     CHARS22 EMADDRS  +21  1 A
     CHARS23 EMADDRS  +22  1 A
     CHARS24 EMADDRS  +23  1 A
     CHARS25 EMADDRS  +24  1 A


The output file:

Code:
FILE TEMP3                     
     EMADDR3  1 25 A           
     CHAR31  EMADDR3       1 A 
     CHAR32  EMADDR3  +1   1 A 
     CHAR33  EMADDR3  +2   1 A 
     CHAR34  EMADDR3  +3   1 A 
     CHAR35  EMADDR3  +4   1 A 
     CHAR36  EMADDR3  +5   1 A 
     CHAR37  EMADDR3  +6   1 A 
     CHAR38  EMADDR3  +7   1 A 
     CHAR39  EMADDR3  +8   1 A 
     CHAR310 EMADDR3  +9   1 A 
     CHAR311 EMADDR3  +10  1 A 
     CHAR312 EMADDR3  +11  1 A 
     CHAR313 EMADDR3  +12  1 A 
     CHAR314 EMADDR3  +13  1 A 
     CHAR315 EMADDR3  +14  1 A 
     CHAR316 EMADDR3  +15  1 A 
     CHAR317 EMADDR3  +16  1 A 
     CHAR318 EMADDR3  +17  1 A 
     CHAR319 EMADDR3  +18  1 A
     CHAR320 EMADDR3  +19  1 A
     CHAR321 EMADDR3  +20  1 A
     CHAR322 EMADDR3  +21  1 A
     CHAR323 EMADDR3  +22  1 A
     CHAR324 EMADDR3  +23  1 A
     CHAR325 EMADDR3  +24  1 A

Thanks Dick.

Dave
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 16, 2009 3:42 am
Reply with quote

Hi Dave,

My bad. . . icon_redface.gif I was going in the wrong direction.

You might save some lines of code if these were put in arrays, but the cpu time (which may be significant) would still be there.

Also, please note that the source has been "Coded" using the bbtag above the Reply Panel. Copy/paste & Code preserves alignment and improves readability. There is also Preview so a post may be reviewed before submitting to the forum.
Back to top
View user's profile Send private message
coxdavi

New User


Joined: 12 Mar 2009
Posts: 30
Location: usa

PostPosted: Wed Sep 16, 2009 3:46 am
Reply with quote

Dick,
No problem. Thanks for the tip on the code. I was wondering if there were any examples of how best to cut back on this long, drawn-out code. I was hoping that someone either had already invented this wheel, or could point me to a sample of a DO loop of some kind that could do it.


Thanks,
Dave
Back to top
View user's profile Send private message
coxdavi

New User


Joined: 12 Mar 2009
Posts: 30
Location: usa

PostPosted: Sat Sep 19, 2009 1:17 am
Reply with quote

I received from EZT support an example of array processing with subscripting, so I put together the following which does the job:

Code:

SORT TEMPX TO TEMPX USING USERIDX                                 
SORT TEMPY TO TEMPY USING USERIDY                                 
JOB INPUT (TEMPX KEY(USERIDX) TEMPY KEY(USERIDY)) FINISH WRAPUP   
100-MATCH-PREP.                                                   
   IF MATCHED                                                     
       INSUB = 1                                                 
       DO WHILE INSUB LE 25 AND EMARRAYI(INSUB) NE ' '           
           MOVE EMARRAYI(INSUB) TO EMARRAYO(INSUB)               
           INSUB = INSUB + 1                                     
       END-DO                                                     
       IF EMARRAYI(INSUB) = ' '                                   
           MOVE '>' TO EMARRAYO(INSUB)                           
           END-IF                                                 
       PUT TEMP3                                                 
        END-IF                                                 
    PUT TEMP4 FROM TEMPX                                       
    GOTO JOB                                                   
 WRAPUP. PROC                                                   
        DISPLAY 'JOB ENDED: ' SYSDATE SYSTIME                   
 END-PROC.                                                     
 REPORT OUTPT1 PRINTER OUTPTFL1 LINESIZE 132 NOHEADING         
 TITLE 1 SYSTIME ' USERIDS GIVE EMAIL ADDRESS FOR HEADER FILE '
 LINE OUTA                                                     


Thanks for your time.

Dave
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Sep 19, 2009 1:27 am
Reply with quote

Good to hear you have this solution - thanks for posting the code icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts DB2 Event passed to the Application P... DB2 1
Search our Forums:

Back to Top