INVENGFILE

From MidrangeWiki
Revision as of 08:33, 26 May 2005 by Al Mac (talk | contribs) (Major Major addition)
Jump to: navigation, search

Explanation for the Program

For various reasons, to be explained in later links, Query is humongously popular at many AS/400 sites but at the same time comes with a mountain of security concerns.

Thus, IT wants to let co-workers run most any Query they please, from some Menu, but not from either command line or IBM commands, which can let them get into unwanted mischef.

Here is a simple CLP/400 program that permits users to key in what file they want to dump via Query, using whatever selection criteria, while leaving contents of the file intact.

A remaining challenge is that ideally we want people to do this stuff, then have their Query selection head off to the JOBQ for actual execution, especially when some files have millions of records. Programming that is more complex than this example.

This program is one of a set of related CLP/400 examples.


Here is the Source Code

/*********************************************************************/ /* */

/* Program INVENGFILE runs RUNQRY *N for FILE of operator choice */

/* */ /*********************************************************************/

             PGM                                                        
                                                                        
/*                Chapter SIX of CL manual explains the rules        */ 
                                                                      
             RUNQRY     QRY(*NONE) ??QRYFILE((IIM)) RCDSLT(*YES)        
                                                                   
            MONMSG     MSGID(CPF6801) EXEC(GOTO CMDLBL(ENDIT)) /* +    
                        F3 F12 etc. allowed */                        
                                                                    
      ENDIT:      ENDPGM