Difference between revisions of "INVENGFILE"

From MidrangeWiki
Jump to: navigation, search
(Major Major addition)
(Explanation for the Program)
Line 11: Line 11:
 
This program is one of a set of related [[CLP/400 examples]].
 
This program is one of a set of related [[CLP/400 examples]].
  
 +
=== RUNQRY *N some_file_name ===
  
 
== Here is the Source Code ==
 
== Here is the Source Code ==

Revision as of 08:34, 26 May 2005

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.

RUNQRY *N some_file_name

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