There use to be a TAATOOL command called CVTHEX that would create a packed key. Natively in CL there is the %BIN function, but I've never used it. Perhaps others may provide an example. Dave
Unconfigured Ad Widget
Collapse
Positioning a File in CL
Collapse
X
-
Positioning a File in CL
%BIN doesn't seem to help... The file I'm trying to read has two key fields, the first is a 3 long character field, the second is a 9 long (zero decimals) packed field. It seems that whetever I concatenate on the end of the 3 digit character portion the RCVF either errors or finds the last record in the file...
-
-
Positioning a File in CL
Phil, You probably have a great reason for positioning a file in CL. Even so, it is usually a red flag that a CL is trying to do too much. With ILE, it is possible to integrate CL and other HLLs more tightly. The CL integration is the weak link, but is still better in all cases I have seen than manipulating hex in pure CL (it is much easier in RPGIV). By using RPGIV and a relatively simple call to QCMDEXC you can mimick just about anything that CL can do in RPGIV. David Morris
Comment
-
-
Positioning a File in CL
Hello Phil, Check out the News/400 site. They published an article last year that allows you to open, read/write/delete database records directly from a CL program. These API's may be just what you're looking for. Regards, Richard Schoen RJS Software Systems Inc. "The AS/400 Report and Data Delivery Experts" Email: richard@rjssoft.com Web Site: http://www.rjssoft.com
Comment
-
-
Positioning a File in CL
It's probably worth the cost of the professional membership just for these API's. They work quite well. Regards, Richard Schoen RJS Software Systems Inc. "The AS/400 Report and Data Delivery Experts" Email: richard@rjssoft.com Web Site: http://www.rjssoft.com
Comment
-
-
Positioning a File in CL
Here you go. Source for the CVTHEX & CVTHEXDEC commands. Sorry the other person didn't want to share. Hope this helps, let me know if you need anything else. I will be glad to email. barbara_edens@compusa.com, good luck.
Comment
-
-
Positioning a File in CL
There's a good reason for not sharing. Please notice the copyright. Any unauthorized use of this code is illegal, and may be subject to criminal prosecution. One should be aware, that Jim Sloan is alive and well, a member of the same user group that I belong to, and might very well be perusing these pages at this moment. Dave
Comment
-
-
Positioning a File in CL
Is there a way of positioning a file in CL with OVRDBF when there is a mixture of character and packed numeric key fields? The help talks about using hex format for packed numerics but that's as far as it goes...
Starting position in file (POSITION) - Help For example, POSITION(*KEY 1 FMT2 X'123F') specifies that: 1. The system searches for a record from the record format FMT2. 2. A single key field is used in the search (even though the key value may have more key fields). 3. The record contains the hexadecimal value 123F (the hexadecimal equivalent of packed decimal value 123.0). You get this record when it is found.
Comment
-
-
Positioning a File in CL
Fortunately, we kept the old QUSRTOOL around, renamed, from before the utilities reverted to Mr. Sloan. Attached is the uncopyrighted source from: QATTINFO member CVTHEX - as file 'CVTHEX Description.txt' QATTCMD member TAACLPB - as file 'CVTHEX CmdSrc.txt' QATTRPG member TAACLPBR - as file 'CVTHEX RpgSrc.txt' This should still work past V3R1; it doesn't use any APIs that would have changed since then. Mr. Sloan keeps his utilities updated for new releases of OS/400 and new functions, and adds utilities; it's worth having.
CVTHEX.zip
Comment
-
Comment