Monday, October 8, 2012

NAPA descriptions deeply

The following blog might be a bit too advanced for beginners. However, if users are wondering how NAPA db looks like there is a way how to look into it. By "looking into" any object in NAPA dbs you can basically access absolutely whatever data (even the one not "officially" accessible in other ways).

So what's the trick? Of course few commands. Here they are:

!MAP command is showing the content of the memory. It means it's showing all "descriptions", which are accessible at the moment in runtime memory. All these objects are flagged by so-called reference number. It's an id, which is used for handling of "descriptions".

!DML command is used for listing (showing) the "description" from the memory on the screen (into NAPA main window).

Note: If the "description" is not yet in the memory, you can easily make it accessible by DB.READ service function (or DB calculator command).

Probably the most straight forward way to show the functionality is to make an example:
E.g. you are wondering how the NAPA setup is stored in the system.

  • Let's make a setup called SET1 like this: SET,  Z=0.9, Z=5, Z=8, PROF
  • Get it into the runtime memory (rn is variable containing the reference number): @rn=DB.READ('SETUP*SET1','-',1,'-','E')
  • Now use !MAP command to see all descriptions in the memory: !MAP
     ******** DESCRIPTIONS IN MEMORY ******** 
     name                      type        date      refnr  nrec   nwords
     SETUP*SET1                   0  1539119694      22022     1       10
  • In my case the reference number is 22022. Now we can have a look at the record in NAPA db of our setup: !DML 22022
 *******************DESCRIPTION LISTING*******************

 SETUP*SET1                  TYPE:       0 DATE:   1539119694

 LISTING OF RECORD     2000   TYPE:   3   SIZE:    2
     1     SET
     2     Z=0.9, Z=5, Z=8, PROF

 *******************END OF DESCRIPTION LISTING*******************

As you can see it's not any surprise, but this is only simple example. It's much more interesting on tables or loading conditions. Someone can now ask how to access these data. For this purpose there is a calculator command REC.
!VAR LIS array
SET                   Z=0.9, Z=5, Z=8, PROF
!CAL array(2)
Z=0.9, Z=5, Z=8, PROF

As you can see from above, NAPA dbs are storing data in relatively simple way using sets of arrays. Each object (description) is matrix (vector of vectors/2D array), while descriptions are flagged by reference number and each array is flagged by so-called record number (2000 in example above). It is not always 100% clear what all "records" are containing - this is NAPA company know-how, but in many cases it is really easy to understand just by looking at the examples.

No comments:

Post a Comment