× 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.



It is said that, when one has a problem that is "too much" one should go do
something else for awhile and then come back to the conundrum so I made the
bed, ytook out the trash, and a few other chores. No luck seeing the forest
for the trees so I posted my issue.

Later I went outside (in this sweltering heat) on my deck to smoke some
cigars and swill some Jack Daniels. Halfway through the second cigar I
would have done a face palm if my hands had been free.

If I had posted the entire program, Jon, you would have seen it instantly.
I did include the clue "procedure". The DS was in a procedure so the
variable defined there are "local". I usually include things like this in
the main body. I don't know why I didn't this time.

Sorry for the wild goose chase.

Jerry C. Adams
4 out of 3 people struggle with math.
IBM i Programmer/Analyst
--
NMM&D
615-585-2175

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Jon
Paris
Sent: Tuesday, June 21, 2022 12:32 PM
To: RPG programming on IBM i
Subject: Re: Data Structure Issue

Jerry - is it possible you are missing a PTF or two? I just ran a version
of your code and it worked as expected.

This is the actual RPG code I used: Couldn't be bothered to work out the
fixed form F-spec!

Dcl-F Play WORKSTN;
D DS
D GL# 13s 0
D comp 2s 0 Overlay(gl#)
D div 2s 0 Overlay(gl#:*Next)
D dept 2s 0 Overlay(gl#:*Next)
D acct 4s 0 Overlay(gl#:*Next)
D sub 3s 0 Overlay(gl#:*Next)

GL# = 1234567890123;
Exfmt Testrec;
*InLr = *On;

And this is the DDS

A R TESTREC

A 17 4'Comp'
A 17 9'Div'
A 17 13'Dept'
A 17 18'Acct'
A 17 23'Sub'


A COMP 2 0O 18 5
A DIV 2 0O 18 10
A DEPT 2 0O 18 14
A ACCT 4 0O 18 18
A SUB 3 0O 18 23

All done with VS Code too!
On Jun 21, 2022, at 10:00 AM, Jerry Adams <midrange@xxxxxxxx> wrote:

First, please bear with me; at least the part that has to use fixed-format
D-specs. The company will not pop for RDi so I'm stuck with SEU which
does
not like free-format F- and D-specs.



Second, we are at release 7.4.



Now for the problem. I am writing a pretty simple inquiry into a control
table. The original developer defined the General Ledger distribution in
a
single field. To make things more readable for the client I decided to
break out the different parts into the fields.



On the display file I have this defined as:



16 4'G/L Distribution'

DSPATR(UL)

17 4'Comp'

17 9'Div'

17 13'Dept'

17 18'Acct'

17 23'Sub'

COMP 2 0O 18 5

DIV 2 0O 18 10

DEPT 2 0O 18 14

ACCT 4 0O 18 18

SUB 3 0O 18 23



Originally, I coded the procedure that outputs the format as



D DS

D GL# 13s 0

D comp 2s 0 Overlay(gl#)

D div 2s 0 Overlay(gl#:*Next)

D dept 2s 0 Overlay(gl#:*Next)

D acct 4s 0 Overlay(gl#:*Next)

D sub 3s 0 Overlay(gl#:*Next)



With



gl# = stxgl#;



where STXGL# is the G/L distribution in the control table. But when I
tested the program, the COMP, etc., fields all came out as *Zeros. I put
the program under debug , and everything showed the values that I
expected,
not *Zeros.



Puzzled was I. Anyway, I changed the DS spec to use subfields prefixed
with
a 'q' and, then, added the following code to the procedure:



gl# = stxgl#;

comp = qcomp;

div = qdiv;

dept = qdept;

acct = qacct;

sub = qsub;



The program now works as expected. But, since the original program COMP
showed "20" when I debugged the procedure, why did it not work? Probably
something really obvious that I cannot see, but bear in mind that I am
blind
in one eye and wear glasses for the other one.





Jerry C. Adams

To me "Drink Responsibly" means don't spill it.

IBM i Programmer/Analyst

--

NMM&D

615-585-2175



--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.