Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Two lists, one ENFORM output

277 views
Skip to first unread message

Shiva

unread,
Mar 11, 2015, 2:44:39 PM3/11/15
to
Hi everyone,

Back again with a more stranger question. Is there a way we can write one enform that will have two LIST meaning two separate set of reports, written to a single OUT file specified at the start of the ENFORM? Is it possible to do that? As far as I've researched it seems pretty impossible. And of course we can write two ENFORM and the solution is simple as that but I just wanted to check whether we can write one ENFORM that can use LIST and WHERE twice without having to write the ENFORM as a whole once again!?

Sorry for the stupidity that lays bare in the question. I just had to ask. Sorry :)

Thanks for your patience as always and appreciate any advice. :)

Keith Dick

unread,
Mar 11, 2015, 5:02:14 PM3/11/15
to
I can suggest two approaches.

The first is simpler, though probably not as suitable. You could create an entry-sequenced file, name it in an ?OUT command in your ENFORM command, then run two LIST commands. The output from the two LIST commands will appear in that one file. There will be no separation between the end of the first report and the start of the second report. You could use an AT END statement to get ENFORM to print some blank lines at the end of the first report so there is some space before the second report starts. If you want to print the combined report on a printer, that might not work so well, since there will be no forms control commands in the entry-sequenced file. You could easily print it with the command

FUP COPY file,$S.#LP

but the lines probably will not appear at the proper places on the pages. If nice appearance isn't important, it would get the job done.

You cannot look at the contents of an entry-sequenced file with EDIT or TEDIT, so if the idea is to get two reports into one file that you could look at with an editor, you could use an EDIT command to copy the lines from the entry-sequenced file into an Edit file, assuming the report lines are not too long and there are not too many lines in the report.

If the goal is to get two LIST reports into a single spooler job, there is a second approach that is a little more work, but does the job well. Remember the discussion about terminal substitute programs? The same kind of program can be used to accept output intended for a printer and pass it along to the spooler.

The program would open its OUT file, then go into a loop reading its $RECEIVE file and reproducing the operations it receives to its OUT file. Data lines it would just write to its OUT file. For system messages, it would check the message type and do the appropriate thing. OPEN and CLOSE messages would not be passed on. For CONTROL, SETMODE, CONTROLBUF, and SETPARAM messages, it would call CONTROL, SETMODE, CONTROLBUF, or SETPARAM, getting the function and parameters from the system message. For every message, it would call REPLY with a filesystem status of 0, then it would read a new message from $RECEIVE. The code is rather simple.

You would run this program before starting ENFORM, and give it a process name, specify OUT as a spooler collector, and include the NOWAIT option, In the ENFORM commands, you would name the process' name in an ?OUT command. Do as many LIST commands as you like. After exiting ENFORM, use a TACL STOP command to stop the process name.

Since the program does not pass along open and close operations, the spooler sees just one open when the output gathering program starts, and one close when you kill the program with the STOP command after the ENFORM has exited. So all the output that flowed through the program is in one spooler job. ENFORM does a page eject before it starts writing a report, so each LIST command's output would be properly-separated from the previous report, and any other special spacing will be done properly since the program passes along all the other system messages. The program does not buffer anything, so it is safe to stop it with a STOP command.

Shiva

unread,
Mar 12, 2015, 2:31:47 PM3/12/15
to
Thanks for those two options, Keith! Very eye opening, I should say. But a doubt. Would I be able to list twice in a single enform? Like below.

?DICT $VOL.SUBVOL
?ASSIGN REC, FILE;
?OPEN REC;

LIST BY

A,
B,
C

WHERE A > B;

LIST BY

C,
D

WHERE C = D;

CLOSE REC;

Multiple LIST within a single enform, is it possible?

Keith Dick

unread,
Mar 13, 2015, 12:28:31 AM3/13/15
to
Shiva wrote:
> Thanks for those two options, Keith! Very eye opening, I should say. But a doubt. Would I be able to list twice in a single enform? Like below.

Yes. I thought I made that clear, but I guess not clear enough.

Shiva

unread,
Mar 14, 2015, 1:44:21 AM3/14/15
to
Yes, you had. I just had to make sure that I understood it right! Ha ha. I could never see any mention of that in the Enform ref manual. Looking in the wrong places possibly!


Also I was never aware before your mention that a FUP COPY can write to a printer or a spool location! Pretty good tip! Thanks again! :)

Shiva

unread,
Mar 16, 2015, 3:03:31 PM3/16/15
to
Another enform query. Did not want to start a new post all over again for that. Hence the sub-post.

Say there are two fields in a file. Field A has names and field B has age. I want to select the count on field A for all values of field B. Like a count of all the people in same age for all ages.

I tried LIST (count) A BY B. It did not work. LIST (count) A, B - also did not work. Gave the same result both of them just swapped two columns.

I also tried LIST (count) A, B FOR CHANGE ON B; Didn't work either. Think I should rather go back to the manual rather than trying things out here.

I'm sure there's some way - but I just can't figure it out.

Also I have another query. I think I have asked this before, I just wanted to clarify. Again. I have the field A as above. Containing names. I want to select the first two letters of each of the values for field A and check whether they are "SA" - but I think [1:2] against field A is for the OCCURS clause. So there's really no way to test that as a condition, is there?

Tone

unread,
Mar 16, 2015, 7:22:57 PM3/16/15
to
On 03/17/2015 06:03 AM, Shiva wrote:
> Another enform query. Did not want to start a new post all over again for that. Hence the sub-post.
>
> Say there are two fields in a file. Field A has names and field B has age. I want to select the count on field A for all values of field B. Like a count of all the people in same age for all ages.
>
> I tried LIST (count) A BY B. It did not work. LIST (count) A, B - also did not work. Gave the same result both of them just swapped two columns.
>
> I also tried LIST (count) A, B FOR CHANGE ON B; Didn't work either. Think I should rather go back to the manual rather than trying things out here.
>
> I'm sure there's some way - but I just can't figure it out.

LIST BY B COUNT (A OVER B) HEADING "Age Counts";

>
> Also I have another query. I think I have asked this before, I just wanted to clarify. Again. I have the field A as above. Containing names. I want to select the first two letters of each of the values for field A and check whether they are "SA" - but I think [1:2] against field A is for the OCCURS clause. So there's really no way to test that as a condition, is there?
>

LIST A WHERE A BEGINS WITH "SA";


Shiva

unread,
Mar 17, 2015, 2:31:05 PM3/17/15
to
Hi Tone,

That did work. Thanks a lot!

Aslo I read that I could use THRU clause for numbers though I can't use just '72' as first two numbers. There's really a lot that could be done through ENFORM after all!

Also I'm trying the below..

?DICT $VOL.SUBCOL
?ASSIGN A, FILE;
OPEN A;
OUT $S.#J1
TITLE "text"
SKIP 2
LIST BY A,B WHERE X > 1
AT END PRINT "END";
TITLE "last"
LIST BY A COUNT (B over A)
WHERE A > 1
AT END PRINT "LAST";
CLOSE A;

In the above I always get the output in the spool as two different job numbers. I understand that it is because of AT END that different job numbers are created even though in the same location name given at the start. (#J1)

Is there a way to write them all to a single OUT location and job number?

Though I have sorted this with a manual workaround to pick from both job numbers later on, I would like to know if there is a fix within ENFORM itself (as is more likely to be)!

What creates a spool output? I see that there is a job created in the OUT name that was specified while running the enform (ENFORM /IN file, OUT $S.#check) as #CHECK. Which is fine.

But after that there is the first list against $S.#J1 and then an empty $S.#J1 and then with the final list as job location $S.#J1 one after the other so the job number is different.

Any idea why?

Tone

unread,
Mar 17, 2015, 7:35:45 PM3/17/15
to
On 03/18/2015 05:31 AM, Shiva wrote:
> Hi Tone,
>
> That did work. Thanks a lot!
>
> Aslo I read that I could use THRU clause for numbers though I can't use just '72' as first two numbers. There's really a lot that could be done through ENFORM after all!
>
> Also I'm trying the below..
>
> ?DICT $VOL.SUBCOL
> ?ASSIGN A, FILE;
> OPEN A;
> OUT $S.#J1
> TITLE "text"
> SKIP 2
> LIST BY A,B WHERE X > 1
> AT END PRINT "END";
> TITLE "last"
> LIST BY A COUNT (B over A)
> WHERE A > 1
> AT END PRINT "LAST";
> CLOSE A;
>
> In the above I always get the output in the spool as two different job numbers. I understand that it is because of AT END that different job numbers are created even though in the same location name given at the start. (#J1)
>
> Is there a way to write them all to a single OUT location and job number?
Given an INFILE of :

OPEN A;
LIST A,B;
LIST B,A;
EXIT;

ENFORM/IN INFILE,OUT $S.#J1/ will get both listings in the one
spooler job, however it will include the ENFORM statements, albeit on
separate pages.

Given an INFILE of :

OPEN A;
?ASSIGN QUERY-LISTING,$S.#J2
LIST A,B;
LIST B,A;
EXIT;

ENFORM/INFILE,OUT $S.#J1/ will get the ENFORM commands in #J1 and
both reports in #J2 separated by blank pages.

Why is the behaviour of ?ASSIGN QUERY-LISTING different to ?OUT ?

I'm not sure. Perhaps the developers in their wisdom saw the need
for both report per spooler job and all reports in one spooler job :-)

Shiva

unread,
Mar 18, 2015, 3:45:44 PM3/18/15
to
There's a lot to know about ENFORMS for me at least! Wow.

And I could not find QUERY-LISTING, and a look into the manual tells me that it is ?ASSIGN QUERY-REPORT-LISTING and it worked. Thanks. I also did have a look at the ?ASSIGN QUERY-COMPILER-LISTING, its good that they have thought of so many things while building up a query language! Just amazing.

But still.... I am unable to get that blank page between two different LISTs. I could not find any mention about that either, in the manuals.

Is there a way to inject this (a blank page) into the output!?

Tone

unread,
Mar 18, 2015, 7:16:58 PM3/18/15
to
On 03/19/2015 06:45 AM, Shiva wrote:
> There's a lot to know about ENFORMS for me at least! Wow.
>
> And I could not find QUERY-LISTING, and a look into the manual tells me that it is ?ASSIGN QUERY-REPORT-LISTING and it worked. Thanks. I also did have a look at the ?ASSIGN QUERY-COMPILER-LISTING, its good that they have thought of so many things while building up a query language! Just amazing.

Sorry about that.
>
> But still.... I am unable to get that blank page between two different LISTs. I could not find any mention about that either, in the manuals.
>
> Is there a way to inject this (a blank page) into the output!?
>
Here is the test I did. You can see in peruse pages 2 and 4 are blank.
I did not do anything special to enable this.

19> enform/out $s.#j1/
>open zmscpu;
>?assign QUERY-REPORT-LISTING,$s.#j2
>list cpu-num swaps;
>list cpu-num dispatches;
>exit;

20> peruse
PERUSE - T9101H02 - (01OCT2013) SYSTEM \SYS
(C)Copyright 2012 Hewlett-PackardDevelopment Company, L.P.
JOB BATCH STATE PAGES COPIES PRI HOLD LOCATION
359 READY 1 1 4 #J1
360 READY 4 1 4 #J2
_j360
_l1
CPU-NUM SWAPS
------- --------------
0 0
1 0
2 0
3 0
4 0
5 0
_l2
_l3
CPU-NUM DISPATCHES
------- --------------
0 598
1 512
2 503
3 399
4 477
5 482
_l4
_del;e

rkd...@gmail.com

unread,
Mar 19, 2015, 5:32:07 AM3/19/15
to
I did not know that QUERY-REPORT-LISTING did not close and reopen the file (which is what causes a new spooler job to be created). It is interesting that it works differently than the ?OUT file. That might be a bug, or it might have been intentional. I don't know.

It seems odd to me that the second LIST in the QUERY-REPORT-LISTING spooler job does not start on a new page. ENFORM usually does a form feed at the beginning of the LIST output. I don't know why that would not be done when the output goes to the QUERY-REPORT-LISTING. In fact, the description of QUERY-REPORT-LISTING says that if the file is a process, ENFORM treats it as a spooler collector, which should mean that it gets control messages. Very odd.

If you had used the approach I described before of using ?OUT to to a process that passed through all the messages except the OPEN and CLOSE messages to its output and sent the output of that process to a spooler location, all the output would have been in one spooler job, since the close and open that makes a new spooler job would be dropped by the gather process. Using the QUERY-REPORT-LISTING is easier, though, assuming it does what you want.

Something you could try to get the second LIST output to start on a new page with the QUERY-REPORT-LISTING approach would be to use AT START FORM between the two LIST commands. That might force ENFORM to do a form feed before starting the second report. If that doesn't work, try using AT END FORM before the first LIST. If neither works, it might be that output to QUERY-REPORT-LIST suppresses control messages, even though the manual says it will treat processes as spooler collectors. If that is the case, you would have to use the gather process approach I described earlier.

There is a small chance that when using the gather process approach, ENFORM might check the DEVICEINFO for the OUT file, see it is not a printer or spooler collecctor, and suppress control messages. If that happens, you could give the gather process the appropriate subtype to tell ENFORM it is a spooler collector and see whether that works. ENFORM might switch to using level 3 spooling when it sees its output file is a spooler collector, and I don't know whether a simple gather process that just passes messages from input to output will do the right thing when its input is level 3 spooler messages. I think it probably will work correctly, but I've never tried it. You would have to make the buffer into which you read the messages from $RECEIVE larger, since level 3 spooler messages contain many lines.

Shiva

unread,
Mar 19, 2015, 11:13:09 PM3/19/15
to
Thanks tone, silly me. I gave a list all and it never showed the blank page, hence I got confused. The blank pages are there. Thanks! :)

RKD, that's insightful. I'll try FORM feed AT START and AT END. Thanks a lot for those details. :)
0 new messages