Re: Need help on PHP for MPE/ix



How is the 'assoc array of item values' declared in php? Many languages
store data of different types declared in sequence in different pools of
memory, and only keep them in the sequence declared when inside a struct { }
Type of declaration.
Some variants of Image calls (BasicV and BBX) allow the buffer to be a list
of discrete data items that it assembles into a buffer for writes/updates.
If one item is an array, it must be declared as such in the list

Eg an array in Basic of strings Item$(20)[2]
If declare in an Image update as Item$ will give almost EXACTLY the
symptom you are getting - almost because unless Item$[2] is Not separately
declared from the array version (bad practice!) it will be an empty string.
This type must be declared in the image call as Item$(*) to inform Image
that it is an array, and all elements must be transferred.

In C an Image record would just be a struct as in
Struct {
Char key[6];
Char item[20][2];
..
..} rec1;
whose length must match what image expects, and it will all get
written/updated. Can you do a length display on your buffer,as in C one does

printf("Rec1=%d\n",sizeof(struct rec1));

??

So, please show us the declaration of the record buffer, and its
specification in the update call....

jp

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:HP3000-L@xxxxxxxxxxxxx] On Behalf
Of Pavan Kumar Rati
Sent: Friday, 28 July 2006 3:53 AM
To: HP3000-L@xxxxxxxxxxxxx
Subject: Re: [HP3000-L] Need help on PHP for MPE/ix

Hi Olav,

Thanks for your suggesstions. In the PHP update call, there is no variable
that needs to be used which is equivalent to the list as you mentioned in
your below mail. Here is the syntax of the dbupdate intrinsic in PHP:

array mpe_dbupdate(int resouce_id, string dataset, record number | search
item value, assoc array of item values)

As you can see in the above statement there is no argument which is
equivalent to the list argument that is used in other languages on HP3000.

Regarding the security level, since all the other linear items are updating
properly, I don't see any security constraints imposed on it. I think that
the above intrinsic is developed considering the linear elements and didn't
give much importance towards array elements. Therefore, it is updating
properly the linear elements but not array elements.

Please let me know if you have any more suggesstions to solve this problem.

Once again thanks for your reply and your suggesstions.

Regards,
Pavan Kumar


On 7/25/06, okappert <okappert@xxxxxxxxxx> wrote:

Pavan:

I seems that only the field that are arrays are "null". This would mean
that either PHP does not know how to update arrays or that the program
code
for updating the arrays is incorrect. Since the database is image, one
of
the parameters in the update or put intrinsic requires a list of items to
be
referenced. This list can also be defined as "@;" meaning all. Once the
list is established by the first call to the dataset, the list can be
replaced by a "*;" meaning the same list as previously defined. Be aware
that this list, if not carefully defined for each dataset accessed and
each
time it is accessed, can become corrupted by the use of an invalid list.

One last thing, look at the security level attached to the dataitem
defined at the item level or dataset level.

If this explaination does not help, it will be necessary to look at the
programming code for errors there.


Olav.

Pavan Kumar Rati wrote:

Hi Olav,

I am providing you the Query output which explains how the data got
updated from screens through PHP. Also, I am providing you the hex, octal
and char representation of the fcopy output. If you have any suggesstions
for solving this problem, please let me know.



****************************************************************************
****************************************************************************
******

F itm-item-no eq "1404-4000"

1 ENTRIES QUALIFIED
R ALL




ITM-ITEM-NO =1404-4000
ITM-TITLE =JUST FOR TESTING

ITM-GROUP-CODE =IEAB
ITM-CAT-CODE =IW
ITM-LEAD-NAME =PAVAN RATI
ITM-LEAD-PHONE =234-1474
ITM-ORG-NUMBER =123456
ITM-BASEPLANE =
ITM-BASELINE-CD ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
ITM-BASELINE-MDL ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
ITM-RELEASETYPE1 ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
ITM-RELEASETYPE2 ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
='NULL ITEM'


ITM-PLNG-GRPCD =PGIEAB
ITM-PARTICIPANT =PAVAN
ITM-1ST-CUS-DBT ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'
ITM-IWS-SECTION =AX
ITM-SUB-CUS-DBT ='NULL ITEM'
='NULL ITEM'
='NULL ITEM'

SAVE QUERYOUT
A FILE WITH THE GIVEN NAME ALREADY EXISTS
:PURGE QUERYOUT
SAVE QUERYOUT
E
PAVAN,PAVAN.MSI2(150):LISTREDO
1) showjob
2) listf
3) showjob
4) cls
5) listf @.pavsrc
6) listf
7) query
8) listf quer@
9) fcopy from=queryout;to=;char
10) fcopy from=queryout;to=;char;hex
11) fcopy from=queryout;to=;hex;char
12) listredo
13) fcopy from=queryout;to=;oct
14) fcopy from=queryout;to=;octal
15) query
16) LISTREDO
PAVAN,PAVAN.MSI2(150):REDO 9
fcopy from=queryout;to=;char

PAVAN,PAVAN.MSI2(150):fcopy from=queryout;to=;char
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999




QUERYOUT RECORD 0 (%0, #0)

00000: 1404-4000 JUST FOR TESTING
00044: IEABIWPAVAN RATI 234-1474123456
..........................
00110: SAME: TO 000264-1
00264: ......................................PGIEABPAVAN
............AX........
00330: SAME: TO 000332-1
EOF FOUND IN FROMFILE AFTER RECORD 0

1 RECORD PROCESSED *** 0 ERRORS


END OF SUBSYSTEM
PAVAN,PAVAN.MSI2(150):REDO 10
fcopy from=queryout;to=;char;hex

PAVAN,PAVAN.MSI2(150):fcopy from=queryout;to=;char;hex
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999




QUERYOUT RECORD 0 (%0, #0)

0000: 3134 3034 2D34 3030 3020 4A55 5354 2046 1404-4000 JUST F
0008: 4F52 2054 4553 5449 4E47 2020 2020 2020 OR TESTING
0010: SAME: TO 0028-1
0028: 4945 4142 4957 5041 5641 4E20 5241 5449 IEABIWPAVAN RATI
0030: 2020 2020 3233 342D 3134 3734 3132 3334 234-14741234
0038: 3536 2020 2020 0000 0000 0000 0000 0000 56 ..........
0040: SAME: TO 00C0-1
00C0: 0000 0000 0000 0000 0000 0000 0000 5047 ..............PG
00C8: 4945 4142 5041 5641 4E20 0000 0000 0000 IEABPAVAN ......
00D0: 0000 0000 0000 4158 0000 0000 0000 0000 ......AX........
00D8: SAME: TO 00DA-1
EOF FOUND IN FROMFILE AFTER RECORD 0

1 RECORD PROCESSED *** 0 ERRORS


END OF SUBSYSTEM
PAVAN,PAVAN.MSI2(150):REDO 11
fcopy from=queryout;to=;hex;char

PAVAN,PAVAN.MSI2(150):fcopy from=queryout;to=;hex;char
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999




QUERYOUT RECORD 0 (%0, #0)

0000: 3134 3034 2D34 3030 3020 4A55 5354 2046 1404-4000 JUST F
0008: 4F52 2054 4553 5449 4E47 2020 2020 2020 OR TESTING
0010: SAME: TO 0028-1
0028: 4945 4142 4957 5041 5641 4E20 5241 5449 IEABIWPAVAN RATI
0030: 2020 2020 3233 342D 3134 3734 3132 3334 234-14741234
0038: 3536 2020 2020 0000 0000 0000 0000 0000 56 ..........
0040: SAME: TO 00C0-1
00C0: 0000 0000 0000 0000 0000 0000 0000 5047 ..............PG
00C8: 4945 4142 5041 5641 4E20 0000 0000 0000 IEABPAVAN ......
00D0: 0000 0000 0000 4158 0000 0000 0000 0000 ......AX........
00D8: SAME: TO 00DA-1
EOF FOUND IN FROMFILE AFTER RECORD 0

1 RECORD PROCESSED *** 0 ERRORS


END OF SUBSYSTEM
PAVAN,PAVAN.MSI2(150):REDO 14
fcopy from=queryout;to=;octal

PAVAN,PAVAN.MSI2(150):fcopy from=queryout;to=;octal
HP31900A.05.04 FILE COPIER (C) HEWLETT-PACKARD CO. 1999




QUERYOUT RECORD 0 (%0, #0)

00000: 030464 030064 026464 030060 030040 045125 051524 020106
00010: 047522 020124 042523 052111 047107 020040 020040 020040
00020: SAME: TO 000050-1
00050: 044505 040502 044527 050101 053101 047040 051101 052111
00060: 020040 020040 031063 032055 030464 033464 030462 031464
00070: 032466 020040 020040 000000 000000 000000 000000 000000
00100: SAME: TO 000300-1
00300: 000000 000000 000000 000000 000000 000000 000000 050107
00310: 044505 040502 050101 053101 047040 000000 000000 000000
00320: 000000 000000 000000 040530 000000 000000 000000 000000
00330: SAME: TO 000332-1
EOF FOUND IN FROMFILE AFTER RECORD 0

1 RECORD PROCESSED *** 0 ERRORS


END OF SUBSYSTEM
PAVAN,PAVAN.MSI2(150):


****************************************************************************
****************************************************************************
******
Thanks & Regards,
Pavan Kumar


On 7/25/06, okappert <okappert@xxxxxxxxxx> wrote:

Pavan:

I really wanted Hex format, sorry.

Olav.



Pavan_Kumar wrote:

Hi JP,

Thanks for your valuable suggesstion.

First I retrieved the record from the database. I used the same format
to
insert the value or to update the values to the same dataset in the same
database. But still it is failing.

I have ran the fcopy command that you have suggessted. I got the below
output:


***************************************************************************
PAVAN,PAVAN.MSI2(150):queryHP32216D.03.21 QUERY/NM TUE, JUL 25, 2006,
10:51 AM
COPYRIGHT HEWLETT-PACKARD CO. 1976



assign lockoption=off
data-base=libdb.database

PASSWORD = >>
MODE = >>5


f itm-item-no eq "1404-4000"


1 ENTRIES QUALIFIED


save queryout
e


PAVAN,PAVAN.MSI2(150):listf quer@

FILENAME

QUERYOUT

PAVAN,PAVAN.MSI2(150):fcopy from=queryout;to=;charHP31900A.05.04 FILE
COPIER (C) HEWLETT-PACKARD CO. 1999




QUERYOUT RECORD 0 (%0, #0)

00000: 1404-4000
00044:
.......................
....
00110: ..............20
.............................................
....
00154: SAME: TO 000264-1
00264: ..................5 ................ 3 .........
3 ....
00330: SAME: TO 000332-1
EOF FOUND IN FROMFILE AFTER RECORD 0

1 RECORD PROCESSED *** 0 ERRORS


END OF SUBSYSTEM

***************************************************************************
I could not make out any thing from the above output.

I have been trying to resolve this problem from a long time. If you have
any suggesstions please let me know. If you need any thing from my side,
please let me know.

Thanks again.

Regards,
Pavan Kumar


On Mon, 24 Jul 2006 08:14:25 +1000, john pitman <jpitman@xxxxxxxxxxx>
<jpitman@xxxxxxxxxxx>
wrote:



Is it safe to assume that your data layout matches the record layout ,


based


on 16 bit boundaries, NOT 32 bit alignments? And that the array field
20x2
is a continuous string of 40 chars? PHP (or whatever code you build the
buffer in )doesn't layout arrays in any odd fashion does it? If you ARE
updating an existing record UPDATE is correct, to add a NEW record, PUT
is
correct.

If you find a record in Query and SAVE <filename> it, then fcopy the
file


as


in
Fcopy from=file;to=;char
You will see the record exactly as it exists in the database, excluding
pointers of course. The buffer you are sending to Image should look


EXACTLY


like this. Usually image returning a null value means that either you


loaded


a null (x'0') in the first byte, or that your PUT did not include that


field


in its item list, and Image inserted a null for you to fill out the


buffer.


Hth
jp

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:HP3000-L@xxxxxxxxxxxxx
<HP3000-L@xxxxxxxxxxxxx>] On Behalf
Of Pavan Kumar
Sent: Saturday, 22 July 2006 3:19 AM
To: HP3000-L@xxxxxxxxxxxxx
Subject: [HP3000-L] Need help on PHP for MPE/ix

Hi,

I have a problem with updating the data in turboimage database through

php. I am looking for some kind of help which will solve this problem.

Here is the problem:

We are using Turbo Image database on HP3000 system. I am providing one
table(ITMMSTR) contents for reference

**********************************************************************
**
***********************************************
DATA BASE: LIBDB .DATABASE WED, JUL 19, 2006, 1:17 PM


DATA BASE LANGUAGE ATTRIBUTE: NATIVE-3000


SET NAME:
ITMMSTR,MANUAL

ITEMS:
ITM-ITEM-NO, X10 <<KEY ITEM>>
ITM-TITLE, X70
ITM-GROUP-CODE, X4
ITM-CAT-CODE, X2
ITM-LEAD-NAME, X14
ITM-LEAD-PHONE, X8
ITM-ORG-NUMBER, X6
ITM-BASEPLANE, X4
ITM-BASELINE-CD, 20X2
ITM-BASELINE-MDL, 20X10
ITM-RELEASETYPE1, 5X4
ITM-RELEASETYPE2, 5X4
ITM-PLNG-GRPCD, X6
ITM-PARTICIPANT, X6
ITM-1ST-CUS-DBT, 3X4
ITM-IWS-SECTION, X2
ITM-SUB-CUS-DBT, 3X4

CAPACITY: 40739 ENTRIES: 26845


**********************************************************************
**
***************************************************

I have developed a screen in html for allowing users to enter the
values. At the bottom of the screen, there is button called update.
After entering the data in the fields on the screen and clicking on
the update button, it will call php code, which will try to update the

data entered on the screen in the TurboImage database.

Before updating I stored the values entered against the fields on the
screen in to an array. When I use this array in the update call
intrinsic(mpe_dbupdate), it is not throwing any errors but it updating

"NULL ITEM" value for the arrays like ITM-BASELIN-CD field(marked in
red above). Rest of the fields are updating properly.

I guess I am doing something wrong and therefore it is not working
properly.

If any body have a solution for this problem, please let me know.

Thanks & Regards,
Pavan Kumar

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
========================================================================


* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *







* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

.