Now I need to find a particular entry in a journal using a CL program. The way I use to locate it is to DSPJRNE to put the journal entries in an output file, then use OPNQRYF to filter the desired one. The file is uniquely keyed so my plan is to compare the journal entry data with the key. The problem is that one of the key is a packed decimal so in the journal entry it is treated as hexadecimal code of characters and displayed as some strange symbols. So in order to compare the strings I need to convert the packed decimal key into the corresponding characters. How to achieve this in CL? If using CL is not possible, what about RPG?
Given the hexadecimal code of a character, how to convert it to the corresponding character in CL program?
1k Views Asked by God_of_Thunder At
2
There are 2 best solutions below
6
James Allman
On
If you are pulling journal entries for a specific file you can dump them into an externally described file with a clever use of SQL:
CREATE TABLE QTEMP/QADSPJRN LIKE QSYS/QADSPJRN
ALTER TABLE QTEMP/QADSPJRN DROP COLUMN JOESD
CREATE TABLE QTEMP/DSPJRNE AS (SELECT * FROM QTEMP/QADSPJRN, FILE-LIB/FILE)
WITH NO DATA
DSPJRNE ... OUTPUT(*OUTFILE) OUTFILFMT(*TYPE1) OUTFILE(QTEMP/DSPJRNE)
ENDDTALEN(*CALC)
Related Questions in CHARACTER-ENCODING
- How to encode bytes as a printable unicode string (like base64 for ascii)
- FPDF with iconv from utf8mb4
- Char encoding and SQL in C#
- How to set only one table charset to utf8mb4 without change mysql configuration?
- Why does opening a file in two different encodings work as expected?
- —- " added in HTML when converting MarkDown file to HTML using Jekyll tool
- Unicode error. database malfunctions
- Can we convert ANSI encoded CSV file to utf-8 encoded file with javascript?
- Determining ISO-8859-1 vs US-ASCII charset
- Unexpected Python String Encoding of '/b'
- Rails ActiveRecord string field encoding vs Ruby String encoding
- Jekyll JSON incorrect character encoding
- Nodejs encoding issue
- How do I encode HTML characters within Javascript functions?
- Specifying Encoding While Placing Files In InDesign Using Extendscript
Related Questions in IBM-MIDRANGE
- How can i use Java to call an existing RPG screen program?
- SQL access to RPG OPM database files
- PHP rollback on IBMi db2 doesn't work
- DB2 Concatenate rows
- How to configure IBM i Netserver share so that a new IFS file has its ccsid attribute set to a specified ccsid different from Netserver ccsid
- pyodbc rowcount return in negative
- Using a custom comparator for std::map on IBM i-Series
- IBM i (as400) CIM and ethernet interfaces
- Hikari connections and active AS400 jobs
- Syntax error in odbc.ini
- Create a IBM i Java Toolkit RecordFormat from an IBM i File
- CL: Path name contains embedded nulls (CPD018A)
- AS/400 End User - run keystrokes automatically
- Get Column Description from iSeries v7r1 export to Excel or Access
- Deploy IBM Client Access V7r1 Silently
Related Questions in HEX
- match hex string with list indice
- Twig : Unescape hexadecimal text
- Split a string and convert individual pieces to hexadecimal
- What are the values that appear at the address bar?
- Benefits of storing hex in DB over file
- Unique hex for unique string in java
- convert first column from hex to decimal using awk
- Convert a 0-1 value to a hex colour?
- How can I edit a binary file under Windows by scripting
- How to count the number of characters in a line in a csv file
- c# manipulating a string as a hex code?
- Find and replace hex values in a String in Java using regex
- Passing argb array to int or long
- Converting an Array of Hexadecimal Strings to Numbers
- how do i convert a hex string to its unicode ascii equivalent in swift?
Related Questions in JOURNAL
- Spring Boot Admin Journal history
- How to use grep on dictionary-like file
- MongoDb journal in write concern
- Systemd-journald.service log rotation is not working
- Where can I find "C/C++ Users Journal" code archive?
- NTFS Journal USN_REASON_HARD_LINK_CHANGE event
- Will Windows always allow hooks and/or the journal record?
- How to contribute to iOS Journaling Suggestions?
- NX Journal C# => write name of selected expression into string
- SqLite C# extremely slow on update
- Given the hexadecimal code of a character, how to convert it to the corresponding character in CL program?
- Sqlite Database Browser crahses - how to restore the DB with journal file
- How can i journal all my tables's schema in db2 iseries as/400?
- Opening a sqlite3 DB on a read-only filesystem with a -journal file
- Equivalent dlog for debugging in javascript?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
To answer your immediate question, the CVTCH MI instruction will convert hex to char but I would not go that route; neither in CL nor RPG. Rather, I would take James' advice with a few additional steps.
This will give you an externally described file with the exact same layout as your production file. You can query that, etc.