How do I change the PFKeys on the console?

I want to set a PFKEY to display (but not execute a command) because I could not remember the syntax of the command.

You setup the PFKEYS in a table such as USER.PARMLIB(PFKTAB00)

PFKTAB TABLE(COMMANDS) 
PFK(01) CMD('K E,1')
PFK(02) CMD('K E')
PFK(03) CMD('K E,D')
PFK(04) CMD('K D,F')
PFK(05) CMD('K S,DEL=R')
PFK(06) CMD('K S,DEL=RD')
PFK(07) CMD('D A,L')
PFK(08) CMD('D R,R,CN=(ALL)')
PFK(09) CMD('K D,U')
PFK(10) CMD('V TCPIP,TCPIP,OBEYFILE,USER.TCPPARMS(ROUTE)') CON(Y)
PFK(11) CMD('K E')
PFK(12) CMD("%NETV SHUTSYS") CON(Y)
...
PFK(24) KEY(12)
PFKTAB TABLE(COLIN)
PFK(01) CMD('K E,2')
...

Where PF12 is the command I want to specify – CON(Y) means confirm before executing it.

PFK(24) KEY(12) 

Says make PFK24 the same as PFK12

Multiple tables

You can have multiple definitions (tables) within a file (COMMANDS and COLIN)

The console command

K N,PFK=COLIN

Says – from the currently selected member use the table COLIN.

Use a different member

You can create different members (in addition to having multiple tables within a member)

Issue the commands

T PFK=CP

to set the table to use member PFKTABCP

The command

D PFK,T

displays the tables within the member, for example

PFK TABLES IN PFKTAB00 AVAILABLE FOR USE ON SYSTEM VS01               
TABLE TABLE TABLE TABLE TABLE TABLE
COLIN COMMANDS

You can display the PFKeys for a table using

d pfk,t=COLIN

You can activate a table within a PFKTAB using

  K N,PFK=COLIN

How to use PFKEY tables

You could set up multiple tables in one member, or have multiple members each with one table. For example a table for common TCPIP commands, a table for general commands (including the Netview shutdown command).

You can specify CON(Y) to allow you to change the statement, before executing it. For example in my TCPIP table I have

PFK(10) CMD('V TCPIP,TCPIP,OBEYFILE,USER.TCPPARMS(ROUTE)') CON(Y)

to allow me to change which TCPIP configuration statements to use.

How do I enter a password on the z/OS console for my program?

I wanted to run a job/started task which prompts the operator for a password. Of course being a password, you do not want it written to the job log for every one to see.

In assembler you can write a message on the console, and have z/OS post an ECB when the message is replied to.

         WTOR  'ROUTECD9 ',reply,40,ecb,ROUTCDE=(9) 
wait 1,ECB=ECB
...
ECB DC F'0'
REPLY DS CL40

The documentation for ROUTCDE says

  • 9 System Security. The message gives information about security checking, such as a request for a password.

When this ran, the output on the console was as follows The … is where I typed R 6,abcdefg

@06 ROUTECD9 
...
R 6 SUPPRESSED
IEE600I REPLY TO 06 IS;SUPPRESSED

With ROUTCDE=(1) the output was

@07 ROUTECD1                      
R 7,ABCDEFG
IEE600I REPLY TO 07 IS;ABCDEFG

With no ROUTCDE keyword specified the output was

@08 NOROUTECD                          
R 8 SUPPRESSED
IEE600I REPLY TO 08 IS;SUPPRESSED

The lesson is that you have to specify ROUTCDE=(1) if you want the reply to be displayed. If you omit the ROUTCDE keyword, or specify a value of 9 – the output is supressed.

Can I do this from a C program?

The C run time _console2() function allows you to issue console messages. If you pass and address for modstr, the _console2() function waits until there is an operator stop of modify command issued for the job. If a NULL address is passed in the modstr, then the message is displayed, and control returns immediately. The text of the modify command is visible on the console.

To get suppressed text you would need to issue the WTOR Macro using __ASM(…) in your C program.