• Subject: RE: Data Structures with Structures
  • From: Erick Garske <Erick@xxxxxxxxxxxxxxx>
  • Date: Fri, 22 Jun 2001 08:20:44 -0700

Simon,

As for the command qualifier format that I am using it looks like this:

 FAXPARM:    ELEM       TYPE(*CHAR) LEN(10) CHOICE(*PGM) +          
                          CHOICEPGM(*LIBL/SMR3000) PROMPT('Fax +    
                          parameter')                               
             ELEM       TYPE(*DEC) LEN(4) PROMPT('Beginning column')
             ELEM       TYPE(*DEC) LEN(4) PROMPT('Ending column')   

Now I did consider using *INT2, but the command processor is using a CL and
according the command
help I can't do this. This is the help text that I received:

                                                              
  *INT2                                                       
      The list item is an integer that is passed as a 2-byte  
      signed binary number.  CL programs do not support       
      using binary values in variables.                       
                                                              
  *INT4                                                       
      The list item is an integer that is passed as a 4-byte  
      signed binary number.  CL programs do not support       
      binary values in variables.                             
                                                              
I can see that style wise, length notation looks cleaner than positional
notation. Is that the only advantage though to using length verse
positional?

Also there is enough room for the commands. I think that the maximum size of
a list is 2000 characters, so there is ample room.

Thanks for all the alternatives for processing this type of data.

Erick


-----Original Message-----
From: Simon Coulter [mailto:shc@flybynight.com.au]
Sent: Thursday, June 21, 2001 10:48 PM
To: RPG400-L@midrange.com
Subject: Re: Data Structures with Structures



Hello Erick,

You can overlay the array with the required subfields.  Doing so allows you 
to reference the subfields with an index because they are also arrays in 
their own right.  (This is a neat trick when you need to sort an array by 
different subfields.)

You should also use Integer data types for the command analyzer count 
field. (You probably don't need acmds at all.)

You should also use length notation rather than positional notation for 
the DS subfields.

Implementing the above gives you a structure like:

d @@faxcmds       ds                                       
d  acmds                         2                         
d    bcmds                       5I 0 overlay(acmds)       
d  faxcmdds                     18a   dim(40)              
d    faxqual                    10a   overlay(faxcmdds:1)  
d    faxqualbc                   4s 0 overlay(faxcmdds:11) 
d    faxqualec                   4s 0 overlay(faxcmdds:15) 

On VRM440 and above you can use *NEXT for the OVERLAY keywords to avoid 
manually calculating them.  For example:

d    faxqual                    10a   overlay(faxcmdds)  
d    faxqualbc                   4s 0 overlay(faxcmdds:*NEXT) 
d    faxqualec                   4s 0 overlay(faxcmdds:*NEXT) 

If you've defined the command parameter properly then you'll find that 
there is an additional count field for each element indicating the number 
of subfields and an array of integers after the initial element count with 
the offsets to the elements themselves.  

Please tell me you haven't done something ugly like define an 18 character 
parameter and expect the user to pad the elements manually?  Please tell me 
you haven't used character fields for numeric values?  You should have a 
command definition something like:

             PARM       KWD(FAXCMD) TYPE(E1) MAX(40) +      
                          PROMPT('Facsimile commands')      
                                                            
 E1:         ELEM       TYPE(*CHAR) LEN(10) PROMPT('Command') 
             ELEM       TYPE(*INT2) RANGE(1 9999) PROMPT('Begin')      
             ELEM       TYPE(*INT2) RANGE(1 9999) PROMPT('End')      

Of course, defining the parameter like this means you need to use a based 
structure to navigate the element lists but that is easy enough.

Ensure enough room for 40 elements (2-byte count, 10-byte char, 2-byte 
begin, 2-byte end) plus 40 offset values, plus 2-byte element count.
d @@faxcmds       ds                                       
d  cmdCnt                        5I 0 
d  cmdOffset                     5I 0 dim(40)
d  faxcmdds                     16a   dim(40)              

d faxCmd          ds                  based(@faxCmd)
d    faxElem                     5I 0 overlay(faxCmd:1
d    faxqual                    10a   overlay(faxCmd:3)  
d    faxqualbc                   5I 0 overlay(faxCmd:13) 
d    faxqualec                   5I 0 overlay(faxCmd:15) 

and just move the based structure by adding the offsets in cmdOffset to the 
@faxCmd pointer inside a loop controlled by cmdCnt.  See Chapter 9 of the 
CL Programmer's Reference (or wherever IBM have hidden this stuff in the 
InfoCentre) for details on processing element lists properly.

Regards,
Simon Coulter.


 FlyByNight Software         AS/400 Technical Specialists       
 Eclipse the competition - run your business on an IBM AS/400.  
                                                                
 Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\   
 Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /   
                                                           X    
               ASCII Ribbon campaign against HTML E-Mail  / \   

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.