Q
Problem solve Get help with specific problems with your technologies, process and projects.

OCL example in CL

I come from a S/36 background. Is there any easy way to rewrite the following OCL example in CL?

  
 // * 'Please make a selection'
 // * '   Y=Yes'
 // * '   N=No'
 // * ' '
 // PAUSE 'Enter your selection now...' 

Following is an example program that may help. The SNDUSRMSG will send a message to a message queue and wait for the response. With the valid values parameter you can even limit the responses that you will accept from the user. This command also supports specifying default reply values.

 
             PGM                                                    
             DCL        VAR(&JOB) TYPE(*CHAR) LEN(10)               
             DCL        VAR(&RPLY) TYPE(*CHAR) LEN(1)               
                                                                    
       /* GET CURRENT JOB NAME */                                   
             RTVJOBA    JOB(&JOB)                                   
                                                                    
       /* SEND MESSAGE */                                           
             SNDUSRMSG  MSG('Enter (Y)es or (N)o') VALUES(Y N) +    
                          MSGTYPE(*INQ) TOMSGQ(&JOB) MSGRPY(&RPLY)  
                                                                    
             IF         COND(&RPLY *EQ 'Y') THEN(DO)                
       /* DO YES PROCESSING HERE */                                 
             ENDDO                                                  
                                                                    
             IF         COND(&RPLY *EQ 'N') THEN(DO) 
       /* DO NO PROCESSING HERE */ 
             ENDDO                  
             ENDPGM: ENDPGM               

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.


This was last published in November 2001

Dig Deeper on RPG iSeries programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close