Re: [U2] [UD] Multi-Level Files

2012-11-07 Thread Bill Haskett

Thanks Brett.

It turns out that UD works this way.  The solution was to also pass in 
@RECORD.  Even though @ID passed in the wrong ID, @RECORD passed in the 
correct VOC item.  So, I was able to read attribute #2 (the data file 
path) then proceed from there.  In addition, if this was an "LF" file 
then I parsed through the dictionary to find the data files, then got 
each data file's information.  Passing back as an MV comes out just 
fine.  So a query can look like:


2 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATA F_SIZE
LIST VOC 'APOPEN''APPO' F_DATA F_SIZE 09:12:59 Nov 07 2012 1
VOC... Data Location FileInfo..

APOPEN APOPEN  31,4
   HISTORY   1999,4
   HOLD 5,1
APPO   APPO11,1
2 records listed

Although this doesn't work well for multi-level files in other accounts, 
especially using environment variables for the path, it worked for my 
purposes here.


Bill
Untitled Page



- Original Message -
*From:* bre...@gpmdev.co.uk
*To:* u2-users@listserver.u2ug.org 
*Date:* 11/7/2012 8:51 AM
*Subject:* Re: [U2] [UD] Multi-Level Files

Am not sure why you would be getting the last hashed dictionary item passed.

However, I think you would need to pass something other than @ID to your subroutine - a 
multivalue of files via another I descriptor with subroutine.  Don't know about in UniData but in 
UniVerse VOC<4> has M and <7> an mv of data sections.  The file to open is 
/APOPEN/HISTORY for instance.

As an alternative you could try using a Q pointer to each data section.

HTH

Brett

"Bill Haskett"  wrote in message 
news:<5095a055.8090...@advantos.net>...

I build the following subroutine to be used by a dictionary.

SUBROUTINE D.GETFILEINFO ( Value, atID )
*
** Get information on file using FILEINFO()
*
** Initialize local variables
SP1   = ' '
NULL$ = ''
*
** Assign passed variables
Value= NULL$ ; ** initialize return variable
FileName = atID  ; ** the name of the file (key)
*
** Open the file and get the file information to pass back
OPEN '', FileName TO FileName.FV THEN
 Modulo= FILEINFO(FileName.FV, 5)
 BlockSize = FILEINFO(FileName.FV, 8)
 BlockCode = INT(BlockSize / 1024)
 Value = Modulo : ',' : BlockCode
 CLOSE FileName.FV
END ELSE
 Value = NULL$
END
*
RETURN
END

I use this program in a dictionary item called "F_SIZE".

3 Dev (0)-> AE VOC F_SIZE
Top of "F_SIZE" in "VOC", 6 lines, 95 characters.
*--: P
001: I Return the file information on the defined size
002: SUBR ( "D.GETFILEINFO", @ID )
003:
004: FileInfo
005: 10R
006: S
Bottom.

...which returns the size of the file.  When I use this on a multi-level
file it fails to return the file size.  e.g.

3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
VOC... Data Location FileInfo..

APOPEN APOPEN
HISTORY
HOLD
APPO   APPO11,1
2 records listed

It works fine on regular files.  I tracked the problem down to UniData
doesn't pass in the name of the file to the called subroutine, @ID
doesn't work.  What is passed is the last hashed dictionary item of the
APOPEN dictionary file.  When I put a "CRT" statement in the program
code just below where the "FileName" variable is assigned...

CRT FileName

...the list output looks like this:

3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
*BALANCE*
LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
VOC... Data Location FileInfo..

APOPEN APOPEN
 HISTORY
 HOLD
*APPO*
APPO APPO11,1
2 records listed

I discovered this because I listed the dictionary of the APOPEN file;
which looks like:

3 Dev (0)-> LIST DICT APOPEN NOPAGE
LIST DICT APOPEN NOPAGE 14:51:11 Nov 03 2012 1
Dict Name..

ACCT_F
REP
TEST2
@UQ
ACCT_L
.
CHECK_ID
@HOLD
@APOPEN
VNAME20
.
APPROVED
@ID
AS_LKS
.
BNAME
CBALANCE
ACCTS_VCNT
ACCT_CNT
AMTS1
APMY
*BALANCE*
99 records listed

...and "BALANCE", which UD passes into the subroutine, happens to be the
last dictionary item hashed into the APOPEN dictionary file.  Any idea
why this is the case, or is this some kind of feature.
--
Untitled Page

Bill Haskett


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] [UD] Multi-Level Files

2012-11-07 Thread Brett Callacher
Am not sure why you would be getting the last hashed dictionary item passed.

However, I think you would need to pass something other than @ID to your 
subroutine - a multivalue of files via another I descriptor with subroutine.  
Don't know about in UniData but in UniVerse VOC<4> has M and <7> an mv of data 
sections.  The file to open is /APOPEN/HISTORY for instance.

As an alternative you could try using a Q pointer to each data section.

HTH

Brett

"Bill Haskett"  wrote in message 
news:<5095a055.8090...@advantos.net>...
> I build the following subroutine to be used by a dictionary.
> 
> SUBROUTINE D.GETFILEINFO ( Value, atID )
> *
> ** Get information on file using FILEINFO()
> *
> ** Initialize local variables
> SP1   = ' '
> NULL$ = ''
> *
> ** Assign passed variables
> Value= NULL$ ; ** initialize return variable
> FileName = atID  ; ** the name of the file (key)
> *
> ** Open the file and get the file information to pass back
> OPEN '', FileName TO FileName.FV THEN
> Modulo= FILEINFO(FileName.FV, 5)
> BlockSize = FILEINFO(FileName.FV, 8)
> BlockCode = INT(BlockSize / 1024)
> Value = Modulo : ',' : BlockCode
> CLOSE FileName.FV
> END ELSE
> Value = NULL$
> END
> *
> RETURN
> END
> 
> I use this program in a dictionary item called "F_SIZE".
> 
> 3 Dev (0)-> AE VOC F_SIZE
> Top of "F_SIZE" in "VOC", 6 lines, 95 characters.
> *--: P
> 001: I Return the file information on the defined size
> 002: SUBR ( "D.GETFILEINFO", @ID )
> 003:
> 004: FileInfo
> 005: 10R
> 006: S
> Bottom.
> 
> ...which returns the size of the file.  When I use this on a multi-level 
> file it fails to return the file size.  e.g.
> 
> 3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
> VOC... Data Location FileInfo..
> 
> APOPEN APOPEN
> HISTORY
> HOLD
> APPO APPO11,1
> 2 records listed
> 
> It works fine on regular files.  I tracked the problem down to UniData 
> doesn't pass in the name of the file to the called subroutine, @ID 
> doesn't work.  What is passed is the last hashed dictionary item of the 
> APOPEN dictionary file.  When I put a "CRT" statement in the program 
> code just below where the "FileName" variable is assigned...
> 
> CRT FileName
> 
> ...the list output looks like this:
> 
> 3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
> *BALANCE*
> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
> VOC... Data Location FileInfo..
> 
> APOPEN APOPEN
> HISTORY
> HOLD
> *APPO*
> APPO APPO11,1
> 2 records listed
> 
> I discovered this because I listed the dictionary of the APOPEN file; 
> which looks like:
> 
> 3 Dev (0)-> LIST DICT APOPEN NOPAGE
> LIST DICT APOPEN NOPAGE 14:51:11 Nov 03 2012 1
> Dict Name..
> 
> ACCT_F
> REP
> TEST2
> @UQ
> ACCT_L
> .
> CHECK_ID
> @HOLD
> @APOPEN
> VNAME20
> .
> APPROVED
> @ID
> AS_LKS
> .
> BNAME
> CBALANCE
> ACCTS_VCNT
> ACCT_CNT
> AMTS1
> APMY
> *BALANCE*
> 99 records listed
> 
> ...and "BALANCE", which UD passes into the subroutine, happens to be the 
> last dictionary item hashed into the APOPEN dictionary file.  Any idea 
> why this is the case, or is this some kind of feature.
> -- 
> Untitled Page
> 
> Bill Haskett
> 
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
This message contains information that may be privileged or confidential and is 
the property of GPM Development Ltd. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient ,you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.

This e-mail was sent to you by GPM Development Ltd.  We are incorporated under 
the laws of England and Wales (company no. 2292156 and VAT registration no. 523 
5622 63).  Our registered office is 6th Floor, AMP House, Croydon, Surrey CR0 
2LX.
 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] [UD] Multi-Level Files

2012-11-03 Thread Bill Haskett

I build the following subroutine to be used by a dictionary.

SUBROUTINE D.GETFILEINFO ( Value, atID )
*
** Get information on file using FILEINFO()
*
** Initialize local variables
SP1   = ' '
NULL$ = ''
*
** Assign passed variables
Value= NULL$ ; ** initialize return variable
FileName = atID  ; ** the name of the file (key)
*
** Open the file and get the file information to pass back
OPEN '', FileName TO FileName.FV THEN
   Modulo= FILEINFO(FileName.FV, 5)
   BlockSize = FILEINFO(FileName.FV, 8)
   BlockCode = INT(BlockSize / 1024)
   Value = Modulo : ',' : BlockCode
   CLOSE FileName.FV
END ELSE
   Value = NULL$
END
*
RETURN
END

I use this program in a dictionary item called "F_SIZE".

3 Dev (0)-> AE VOC F_SIZE
Top of "F_SIZE" in "VOC", 6 lines, 95 characters.
*--: P
001: I Return the file information on the defined size
002: SUBR ( "D.GETFILEINFO", @ID )
003:
004: FileInfo
005: 10R
006: S
Bottom.

...which returns the size of the file.  When I use this on a multi-level 
file it fails to return the file size.  e.g.


3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
VOC... Data Location FileInfo..

APOPEN APOPEN
   HISTORY
   HOLD
APPO APPO11,1
2 records listed

It works fine on regular files.  I tracked the problem down to UniData 
doesn't pass in the name of the file to the called subroutine, @ID 
doesn't work.  What is passed is the last hashed dictionary item of the 
APOPEN dictionary file.  When I put a "CRT" statement in the program 
code just below where the "FileName" variable is assigned...


CRT FileName

...the list output looks like this:

3 Dev (0)-> LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE
*BALANCE*
LIST VOC 'APOPEN''APPO' F_DATAW F_SIZE 14:50:50 Nov 03 2012 1
VOC... Data Location FileInfo..

APOPEN APOPEN
   HISTORY
   HOLD
*APPO*
APPO APPO11,1
2 records listed

I discovered this because I listed the dictionary of the APOPEN file; 
which looks like:


3 Dev (0)-> LIST DICT APOPEN NOPAGE
LIST DICT APOPEN NOPAGE 14:51:11 Nov 03 2012 1
Dict Name..

ACCT_F
REP
TEST2
@UQ
ACCT_L
.
CHECK_ID
@HOLD
@APOPEN
VNAME20
.
APPROVED
@ID
AS_LKS
.
BNAME
CBALANCE
ACCTS_VCNT
ACCT_CNT
AMTS1
APMY
*BALANCE*
99 records listed

...and "BALANCE", which UD passes into the subroutine, happens to be the 
last dictionary item hashed into the APOPEN dictionary file.  Any idea 
why this is the case, or is this some kind of feature.

--
Untitled Page

Bill Haskett

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users