SELECT_SQL Examples

SELECT_SQL FIELDS((#W_COUNT ‘count(*)’)) FROM_FILES((REQUEST )) WH
           ERE(‘CLIENT_ID = :RITAID AND STATUS_CODE = 4    AND  BA
           TCH_SEQ_NUM = 0’)                                      
ENDSELECT                                                         
SELECT_SQL FIELDS((#CRGUID ) (#CRTED ) (#CROBATCH ) (#CRBATCH ) (# 
           CRCCNO ) (#CREXPDT ) (#CRAMNT ) (#CRSWIPE ) (#CRQOVR )  
           (#CRRITAS ) (#CRRITAID ) (#CRTCN ) (#CRMUSR ) (#CRCCET  
           ) (#CRORIG ) (#CRFAIR )) FROM_FILES((CRTRAN )) WHERE(‘S 
           UBSTR(CROBATCH,1,2) = :XBFRGN AND CRSWIPE <> :WSWIPE AN 
           D (CRRITAS = 5 OR (CRRITAS = 200 AND CRAMNT < 0))’) ORD 
           ER_BY(‘CROBATCH,CRBATCH’)                               
********** OK to Mark for Completion                               
SELECT_SQL FIELDS((#W_COUNT ‘count(*)’) (#W_SUM ‘SUM(INT(TRANS_AMO
           UNT))’)) FROM_FILES((REQUEST )) WHERE(‘CLIENT_ID = :RIT
           AID AND STATUS_CODE = 4    AND  BATCH_SEQ_NUM = 0 AND C
           OMMAND =:COMMND’) IO_STATUS(#W_IOSTS) IO_ERROR(*NEXT)  
ENDSELECT                                                         
********** put decimal place in amount                            

SUBROUTINE NAME(GETRITASTS)                                       
**********                                                        
SELECT_SQL FIELDS((#INTRN0001 ‘INTRN_SEQ_NUM’) (#STATU0001 STATU00
           001)) FROM_FILES((REQUEST )) WHERE(‘ORIG_SEQ_NUM = :WRT
           AID’) ORDER_BY(STATU00001) IO_ERROR(*NEXT)             
LEAVE                                                             
ENDSELECT                                                         
**********                                                        
IF_NULL    FIELD(#INTRN0001)                                      
SELECT_SQL FIELDS((#INTRN0001 ‘INTRN_SEQ_NUM’) (#STATU0001 STATU00
           001)) FROM_FILES((REQUEST )) WHERE(‘INTRN_SEQ_NUM= :WRT
           AID’) ORDER_BY(STATU00001) IO_ERROR(*NEXT)             
LEAVE                                                             
ENDSELECT                                                         

SELECT_SQL FIELDS((#W_COUNT ‘count(*)’)) FROM_FILES((REQUEST )) WH
           ERE(‘CLIENT_ID = :WRITAI AND STATUS_CODE = :WRITAS  AND
             BATCH_SEQ_NUM = 0’)                                 
ENDSELECT