× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




...if you really have to extract data from a buffer which contains packed values then you can use the MI instruction CPYNV to copy them to zoned types, which is basically a string. Below is an ancient example I found in my library, which may or may not help!

Tim.


h debug(*yes)
h datfmt(*iso) datedit(*YMD/)

d CrtMINumD...
d pr 10i 0
d pvstfDBNTyp 1a value
d pvbinLen 10i 0 value
d pvbinFrc 10i 0 value

d X_T_SIGNED c const(00)
d X_T_FLOAT c const(01)
d X_T_ZONED c const(02)
d X_T_PACKED c const(03)
d X_T_CHAR c const(04)
d X_T_ONLYNS c const(06)
d X_T_ONLYN c const(07)
d X_T_EITHER c const(08)
d X_T_OPEN c const(09)
d X_T_UNSIGNED c const(10)

d CpyNv pr extproc('_CPYNV')
d TrgMINumD 10i 0 value
d ptrTrgNum * value
d SrcMINumD 10i 0 value
d SrcNum * value

d Example ds
d Packed 9p 2

d Char s 9s 2

d SrcNumDsc s 10i 0 Source descriptor
d TgtNumDsc s 10i 0 Target descriptor
/free


Packed = 12345.67; // Initialise example

// Create the MI numeric descriptors for the source and target formats.
SrcNumDsc = CrtMINumD('P': 9: 2); // Source format is packed 9.2
TgtNumDsc = CrtMINumD('S': 9: 2); // Target format is zoned 9.2

// Do the conversion.
CpyNV(TgtNumDsc: // Target descriptor
%addr(Char): // Target value
SrcNumDsc: // Source descriptor
%addr(Example)); // Source value

return;
/end-free


//********************************************************************************************
// This procedure emulates the C macro found in QSYSINC/MIH,MICPTCOM
// which is used to create an MI number descriptor for the MI numeric
// instructions.
//********************************************************************************************
p CrtMINumD b
d pi 10i 0
d pvstfDBNTyp 1a value
d pvbinLen 10i 0 value
d pvbinFrc 10i 0 value

d pbinMINTyp s 10i 0
/free

// Convert the database field type to MI field type.
select;
when pvstfDBNTyp = 'S';
pbinMINTyp = X_T_ZONED;

when pvstfDBNTyp = 'F';
pbinMINTyp = X_T_FLOAT;

when pvstfDBNTyp = 'P';
pbinMINTyp = X_T_PACKED;

when pvstfDBNTyp = 'S';
pbinMINTyp = X_T_ZONED;

other;
pbinMINTyp = X_T_CHAR;
endsl;

return pbinMINTyp * (2**24) + // Shift right 24 bits
pvbinFrc * (2**16) + // Shift right 16 bits
pvbinLen * (2**8); // Shift right 8 bits

/end-free
p e
//********************************************************************************************




________________________________
From: WDSCI-L <wdsci-l-bounces@xxxxxxxxxxxx> on behalf of Darren Strong <darren@xxxxxxxxx>
Sent: 20 October 2017 14:25
To: midrange-WDSC WDSC message board
Subject: [WDSCI-L] SOX monitoring and journal interpreter

Thanks to SOX we're asked to develop a system to monitor activity by
developers on the production system (An IBM i). First, has anyone else
done something like this, and in an overview, how did you do it?

For my attempt, I'm summarizing file journal entries based on some
criteria, like user, and generating a summary report/spreadsheet with a
concatenated key. Then from that, I want to allow an auditor to drill into
that summary to get the detail of file changes. For now, I'm copy/pasting
this "key" into another report program that is going to report change by
change, what happened in that file for that user, job, etc.

Anyway, I'm using the DISPLAY_JOURNAL SQL table function, and I have this
huge and varying format ENTRY_DATA column. This is where the actual file
data is. I'd like to split this into the file's columns on the
spreadsheet, which I could do if it was all character data, but I'm having
trouble figuring out how to split numerics of varying size and format into
something in an RPG variable. If I use %subst to break a chunk of the
buffer out, what kind of field would I feed that into, because the
datatypes will vary so much?


___________________________________
Darren Strong
Dekko

--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/wdsci-l
WDSCI-L Info Page - lists.midrange.com<https://lists.midrange.com/mailman/listinfo/wdsci-l>
lists.midrange.com
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...



or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/wdsci-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.