Re: [U2] Re: Identifying UD files

2006-01-26 Thread Adam Eccleshall
Hi,

Thanks for the suggestions, but the files in question actually cause the
session to terminate with a regular OPEN, and don't even trigger the ON
ERROR clause.  I need to check the file before attempting the OPEN, so
currently I have

Read actual location from VOC entry
OSOPEN actual location (doesn't error like OPEN)
OSBREAD xxx bytes
Compare specific bytes
If bytes are valid, file is UD file

Unfortunately, doing this both valid files and invalid files return 
FILEINFO(file, 3) as 5.

I know many filetypes have specific bytes in them to say what they are, I'm
hoping someone may be able to point me to the right values for UD.

This is on UD7.1 for Windows


Thanks,

Adam

Jonathan D Smith [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Adam,

 Here is how to identify if a VOC pointer is a valid UniData File ... You
 will also notice a handy tip in the ELSE clause code.


 OPEN VOCNAME TO F.FILE THEN
FILETYPE = FILEINFO(F.FILE,3) ; * Refer to UniBasic Commands
 Reference Manual for full list
 (For Reference 2 Hashed, 3 Dynamic, 4 Directory, 5 Sequential, 7 nfa, 8
 os)
 END ELSE
CRT Cannot Open File  ; * Also check udterrlog file as this will
 explain why the file couldn't be opened (6.0.7 onwards) from 6.0.9 onwards
 reporting is controlled via the UDTERRLOG_LEVEL environment variable
 END


 Regards,
 Jonathan Smith
 IBM Certified Solutions Expert 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Re: Identifying UD files

2006-01-26 Thread David A. Green
Have you tried running guide on the files?  If you must do it from UniBasic
then parse the guide output files or read the hash file populated by guide
to determine which have errors and which do not.

Thanks,
David A. Green
DAG Consulting


-Original Message-
 files in question actually cause the
session to terminate with a regular OPEN, and don't even trigger the ON
ERROR clause.  I need to check the file before attempting the OPEN, so
currently I have
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Re: Identifying UD files

2006-01-26 Thread Adam Eccleshall
Hi,

Robert Paterson wrote
 Am I right in thinking you are trying to use the idea of a magic
 sequence to identify the UniData files?

Yes, that's exactly what I'm trying to do.

 If so, I am not sure that such a sequence exists. It does for UniVerse
 as has been described in previous discussions. (I did try it once and
 got part way - but it was not a sure fire operation - and I have since
 changed PC's several times - so no existing documentation I am
 afraid...)

 This leaves you with trying to open the file as being the only sure way
 of checking the file.

 The option of running guide would not be a good one because of the
 length of time to run depending on overall file size.

 My biggest interest is in why you are wanting to do this, as with most
 problems, understanding the why may elicit a different option that works
 better...

It's actually to do with an automated resize routine - we only run guide / 
resize over files that can be opened by UniData.  Unfortunately, as I said, 
in the case of a file I've come across recently, OPEN just crashes out of 
the session without executing ELSE or ON ERROR, so can't be used for this. 
Given the use, using guide to determine file status would defeat the 
purpose. 
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Re: Identifying UD files

2006-01-26 Thread aegerton
From: Adam Eccleshall [EMAIL PROTECTED]
snip
 It's actually to do with an automated resize routine - we only run guide /
 resize over files that can be opened by UniData.  Unfortunately, as I
said,
 in the case of a file I've come across recently, OPEN just crashes out of
 the session without executing ELSE or ON ERROR, so can't be used for this.
 Given the use, using guide to determine file status would defeat the
 purpose.

Given that, kind of kludgy, but perhaps executing a COUNT or a SELECT
filexyz SAMPLE 1 and checking your return codes might suffice.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Re: Identifying UD files

2006-01-26 Thread Robert Paterson
You may be best asking IBM support (or your VAR as applicable) for
whether magic values are available for UniData, or to consider them as
something for a future update.

As for running guide, isn't a good idea to know what your standard files
are and when guide is run analyse the output for problems?

My take on it would be that if guide was run on a file, perhaps using
the -i input list option, then if guide reports that it is not a UniData
file - then you have a problem.

This is where guide's alternate guise of problem determination kicks in.

So personally, if you have a sensible list of files that make up your
application, feeding that into a full guide run actually does all you
want and more.

Just leaves you to analyse...


This e-mail is for the use of the intended recipient(s) only. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not use, disclose or 
distribute this e-mail without the author's prior permission. We have taken 
precautions to minimize the risk of transmitting software viruses, but we 
advise you to carry out your own virus checks on any attachment to this 
message. We cannot accept liability for any loss or damage caused by software 
viruses.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Re: Identifying UD files

2006-01-26 Thread Ken Wallis
If you run udfile against the file, you'll find that is possible to identify
what is and what is not a UniData file by parsing the output.

You have to be a bit careful about file names - ie don't bother looking at
things that are obviously part files in a dynamic file datnnn or idxnnn or
overnnn etc, and you have to not worry about poor english in the output
messages, but it is usable.

Cheers,

Ken

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Adam
 Eccleshall
 Sent: Friday, 27 January 2006 2:35 AM
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] Re: Identifying UD files


 Hi,

 Robert Paterson wrote
  Am I right in thinking you are trying to use the idea of a magic
  sequence to identify the UniData files?

 Yes, that's exactly what I'm trying to do.

  If so, I am not sure that such a sequence exists. It does
 for UniVerse
  as has been described in previous discussions. (I did try
 it once and
  got part way - but it was not a sure fire operation - and I
 have since
  changed PC's several times - so no existing documentation I am
  afraid...)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/