Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Mike Hatfield

#1
Language / Re: Easiest way to create an XML file
June 03, 2024, 05:20:41 PM
Hi Mike,

I will try this irrespective of whether the object can handle the whole xml.
Thanks
#2
Language / Re: Easiest way to create an XML file
June 02, 2024, 05:19:41 PM
Hi jane

I tried it, works well however I need to create XML for a specific EDI enabled provider.
They require the name tags on each element within the node.

I used the *obj/xml to create xml with specific name tags.
This works well for small XML string creation however I suspect the XML string it will create for my purpose will be too large for a call to handle.
What is the best way to create a large XML string?
It would be great if the obj/xml had a write to file option.
Thanks
#3
Language / Easiest way to create an XML file
May 31, 2024, 01:22:48 AM
Hi All,

Is there a program or utility that can read file with a dictionary definition and Output it an XML file 
Thanks
#4
Nomads / Re: Library Query
May 29, 2024, 08:46:44 PM
Hi Jane,
Is there a reason why you chose %C and %S?
As I understand it, these two global variables are reserved and inbuilt into PxPlus and are also linked with ODBC as 'Session ID' and 'Company Code'.

We use %C and %S extensively throughout the dictionary in the file name expression for most of the application files.
EG "./comp"+%S$+"/APTR"+%C$

We set these two Globals in the application session startup, Local and WindX.
If we change the value of these in this program will it 'screw up' the normal operation of file access in the Dictionary in the current session or other sessions or separately in ODBC?

I decided not to use %C$ and %S$ just in case.

In my program I have set a variable %SEQN$=str(int(tim)*1000)
In the Dictionary the file NAME is "General Ledger Enquiry" and physical file is Expression "./WKFL"+%SEQN$
01010  CLOSE (8);
       LET FILECHAN=8;
       LET %SEQN$=STR(INT(TIM*1000));
       LET WORKFILE$="WKFL"+%SEQN$
01020  ERASE WORKFILE$,ERR=1030;
       GOTO 1020
01030  CALL "*dict/dd_updt;update_physical",ERR=9700,"General Ledger Enquiry","","",ERRMSG$

The Query file name is Fixed "General Ledger Enquiry"

Now my program works.
I think including FID(0) in the workfile name was causing a mismatch between the dictionary and the query.
Once I removed FID(0) it all worked.
How nice to 'waste' 1.5 days trying to do something that intuitively you knew should work but stymied by an intenal variable.  :(
Thank you for your input.
#5
Nomads / Re: Library Query
May 29, 2024, 01:40:27 AM



Jane,
Example:
I am currently FID T001
My Dictionary definition is "General Ledger Enquiry" and the file name is expression "./WKFL"+FID(0)
When I save the definition it creates the file WKFLT001
There is no data in the file yet.
Now comes the tricky part.....
If I now create the Query GLTR_QRY whilst still on T001....
I have the choice of using the Dictionary definition name or expression.
IF, I am on the same session, IE T001 the Query maintenance 'sees' the physical file whether I define the query as physical or expression and it will pop up the query screen with no data.
IF, I run my program whilst still on T001 the program ruins and the Query runs and all is good.
IF I now start a new session on T003 my program creates the workfile WKFLT003 and fills it with data (*dict/dd_update created the file).
At the end of the data generation the program PROCESSes the query GLTR_Qry
Unfortunately the Query fails because it thinks the source data file is WKFLT001 and not WKFLT003.
It seems to me that when Query goes to the Dictionary to get the real file name, Dictionary replies with the original physical name that was created directly by the dictionary.
In other words if the Dictionary and the Query use expression for the file name the Query always fails UNLESS the Dictionary Maintenance, Query and my program are all in the same session.

In other words using expression for the file name doesn't work when part of the expression is variable - eg FID(0)
Unfortunately, you can't define a query if it can't find the file that contains the data and its dictionary.

#6
Nomads / Re: Library Query
May 28, 2024, 02:48:56 AM
Hi Stéphane
Sometimes what you think is going to be an easy exercise turns out to be impossible.
I have a generic file definition in the dictionary. I use it to create a unique named work file at runtime using *dict/dd_updt. I'm changing a text based program to modernize it with Query. In my program I want to call Nomads Query that will read/process that unique file name with the
generic dictionary definition. Seems to me there is a shortcoming in the Query options.
Being able to do this with Query would save me a massive amount of recoding time to use a regular nomads panel list boxes.
#7
Nomads / Re: Library Query
May 27, 2024, 08:59:37 PM
Hi Jane, I have already tried what you suggested. Please see attached screenshots of the dictionary definition and query definition.
My WindX session was on FID(0)="T001" in the Dictionary maintenance.
Notice that file ending in T0014, FID(0) is "T001", has been created. The number 4 being, I presume, the content of TCB(13).

This code creates the work file in the main program:
I am in WindX session where FID(0)="T003"
01031  KEYED "WKFL"+FID(0)+STR(TCB(13)),[1:1:2],[2:1:8],[3:1:8],[4:1:3],0,79
01040  OPEN (FILECHAN)"WKFL"+FID(0)+STR(TCB(13))
TCB(13) AT THIS POINT IS 0

See screenshot - query running.
Notice the WKFL" file is defined for "T003 - Correct, but the TCB(13) is 6.
I presume the TCB value is associated with the call level in the stack.

Doesn't matter how I name/define the workfile, by the time the Query wants to read it the name is different because of a random TCB(13) number.
There must be a way to do this. I don't want hundreds of temporary workfiles cluttering up the disk.
#8
Nomads / Library Query
May 27, 2024, 05:12:28 AM
I want to create a Stanard Library Query where you pass it the file name to open for the query.
For example:
I want to create a query that will display a workfile that contains a set of transactions from the general ledger.
The workfile has a generated unique file name: EG GLWK+fid(0)+TCB(13)
I can create a File Dictionary table for a generic GLWK workfile.
My problem is how to tell the Query what file to read and how will it know to use the generic dictionary definition?

Thanks
#9
ODBC / Re: ODBC with latest MS Excel
May 09, 2024, 05:29:31 PM
Hi Devon & Tom,

I see that you found the same solution as I did.
Thanks to all for the responses :)
#10
ODBC / Re: ODBC with latest MS Excel
May 09, 2024, 04:54:37 AM
Hi Ken, That is true but it doesn't allow the selections from the PxPlus ODBC 32/64 interface.

Typical of Microsoft to remove a feature that half the world uses without any explanation of how to work around.
However, I have done some research and I believe I have the solution.
You have to click on File - Options - Data
In Show Legacy data import wizards
tick From Data Connection Wizard (legacy)
tick From Microsoft Query (legacy)
OK

Back in the Spreadsheet
Click Data
Click Get Data
then in the Dropdown you will see Legacy Wiards - From Microsoft Queary (Legacy)
Et Voila!!

#11
ODBC / ODBC with latest MS Excel
May 08, 2024, 10:10:34 PM
I see that MS Excel - Data - Get Data - Other Sources- MS Query has disappeared from the latest version of Excel.
How do we now run PxPlus ODBC ?
Thanks
#12
Programming / Re: Spawning a session
April 18, 2024, 09:39:00 PM
What if the application is not Nomads - Character only?
#13
Programming / Spawning a session
April 18, 2024, 01:34:40 AM
Hi All, I'm running a plus/cs windx session.
I want to be able to open a new window/session from the current program.
In that new window I want to have it run a program that will display some lines of customer information text. When I find the text I want to switch back to the calling windx session and be able type in some of the text. When I'm done I want to close the new window/session either by clicking on the new session 'x' or issuing a close/drop or whatever in the calling program.
 
Would you believe in the nearly 26 years of programming with Pvx/PxPlus I've never had occasion to do this.
Is this accomplished by spawning a session or is there an easier way. I did do a test with *plus/cs/spawn. It gives me a new session window but none of the global variables from the calling application.
If this is the correct approach how would I place the following in the spawn argument cmdline   -  PROCESS "ARCM_INFO",%PATH_ROOT$+"dictionary/SM_CZ.EN",R2$

I don't seem to be able to do this with a dialogue window. IE Once inside the dialogue window you can't swith back and forth between the dialogue and calling program.

Thanks
#14
Programming / Re: TCB(44) Always a Positive Number?
July 10, 2023, 11:52:52 PM
Our office is in Brisbane Australia - currently UTC+10
It's 13:52 here
TCB(44) is -36000
#15
Many moons ago in the days before self-expanding files we wrote a utility program to change key size, change record length and the number of records in the file. I think I was a lot younger then  :-\