× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Writing your own commands (was: Making command parameters off-limits)
  • From: Buck Calabro <Buck.Calabro@xxxxxxxxxxxx>
  • Date: Tue, 19 Jun 2001 11:40:18 -0400

>For something like your own wrksplf command, I
>think (I could be wrong) that you need to use UIM 
>and the list api's.  

You won't need UIM, but you will need the list APIs.

>This will be more work than the validity checking program.  

Undoubtedly.  There are two approaches to writing your own WRKSPLF command
(for example.)  Wrap the IBM command in your own CL program or write all the
functionality yourself.

This is a silly example, but here is something to look at:

CMD  prompt('Our WRKSPLF shortcut')            
PARM kwd(USER) +                               
     type(*NAME) +                             
     len(10) +                                 
     dft(*RESTRICT) +                          
     choice('*RESTRICT, *CURRENT, user name') +
     spcval('*RESTRICT' '*CURRENT') +          
     prompt('User')                            

pgm &user                                                         
                                                                  
dcl &user    *char 10                                             
dcl &jobUser *char 10                                             
                                                                  
/* See if somebody should be restricted but slipped by */         
rtvjoba user(&jobUser)                                            
if (&jobUser *eq 'JOHNDOE') do                                    
  if (&user *ne '*RESTRICT') do                                   
    chgvar &user '*RESTRICT'                                      
  enddo                                                           
enddo                                                             
                                                                  
/* Restricted users can only see the splf's in their data area */ 
if (&user *eq '*RESTRICT') do                                     
  rtvjoba user(&jobUser)                                          
  rtvdtaara &jobUser &user                                        
enddo                                                             
                                                                  
QSYS/WRKSPLF select(&USER)                                        
       
endpgm 

Both sources are named WRKSPL.  When you compile the CMD, the defaults will
see to it that the command calls your CL program (prompt it to see what I
mean.)  If you exactly match the IBM command's parameter list, you can even
call your CL program WRKSPLF and have the IBM command call your CL...

This is not hard at all, and you can basically do anything you want in your
WRKSPL, whilst leaving the IBM functionality in place.  Just call WRKSPL
from your menu instead of WRKSPLF.  This is much easier than writing the
complete WRKSPLF functionality yourself.  If you're interested I can email
you an antique boilerplate for the QUSLSPL API.

Buck Calabro
Commsoft; Albany, NY
Visit the Midrange archives and FAQ at http://www.midrange.com
"...the humourous man shall end his part in peace..."
  -- Hamlet Act II, scene ii
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.