CL program to transfer a job to QINTER

295 pts.
Tags:
CL programs
CLP
iSeries
QINTER
Telnet
V5R4
hi guys, this is a long one. i use to telnet a client in a virtual dsiplay, using the command telnet rmtsys(clientsys) rmtvrtdsp(operacao). The problem is that if someone is using this display, and you try to access it, you will be kicked out without knowing why. So, i need some help to write a CL to automaticaly transfer the job to qinter when the virtual display is occupied. i hope the text is clear. Tanx in advance

Software/Hardware used:
iseries v5r4

Answer Wiki

Thanks. We'll let you know when a new response is added.

Why not try telnet rmtsys(clientsys) without the remote display it will use the *DFT parameter and if remote system is setup to use Virtual devices it will create a QPADEVXXXX device in the QINTER Subsystem

Discuss This Question: 13  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Aringarosa
    hi rickmcv, because we in the client we use a software where some devices are not created. that's why we do telnet to a rmtvrtdsp. what i need is something like this: telnet rmtsys(cccamcv) rmtvrtdsp(operacao) if rmtvrtdsp(operacao) is on signon display status, then do telnet rmtsys(cccamcv). tanx
    295 pointsBadges:
    report
  • Rickmcd
    In that case would need to create the CL to do first telnet command and monitor for msg CPF8902 using right after command MONMSG MSGID(CPF8902) EXEC(Telnet 2nd command))
    1,605 pointsBadges:
    report
  • Aringarosa
    I've tried this MONMSG MSGID(CPF8902) EXEC(Telnet 2nd command)). but it still doesn't work. i've even tried with rclcfgsts it doesn't work anyway.
    295 pointsBadges:
    report
  • Rickmcd
    The only thing to do is after running the CL make sure it was compiled with Log CL Commands and after running from Command line look at joblog to see what errors received.
    1,605 pointsBadges:
    report
  • Aringarosa
    the error recieved is...cpf8902...this is killing me
    295 pointsBadges:
    report
  • Rickmcd
    Off the top of my head cl should be PGM telnet MONMSG MSGID(CPF2204) EXEC(TELNET RMTSYS(RMTSYS) + RMTVRTDSP(VIRTDSP2)) endpgm then if not working check log again.
    1,605 pointsBadges:
    report
  • TomLiotta
    Try this:
    pgm
    
       dcl   &MsgId       *char     7
       dcl   &RmtSys      *char   256     value( 'CCCAMCV' )
       dcl   &RmtVrtDsp   *char    10     value( 'OPERACAO' )
    
       telnet      rmtsys( &RmtSys ) rmtvrtdsp( &RmtVrtDsp )
    
       dountil   ( &MsgId *eq ' ' )
          rcvmsg   pgmq( *EXT ) msgtype( *DIAG ) msgid( &MsgId )
          if ( &MsgId *eq 'CPF8902' )  do
             telnet rmtsys( &RmtSys )
             leave
          enddo
       enddo
    
       return
    
    endpgm
    Change the value for &RmtSys when you want a different system. Change the value of &RmtVrtDsp when you want a different device. You should be able to compare messages in your joblog to the parms for RCVMSG to learn some of what's happening. Run TELNET from a command line a couple times and look at the message details for all messages it sends. However, the code is not complete. It doesn't account for what may happen if you run it multiple times in the same job, especially if other TELNET commands have been run; and it doesn't do a good job of managing the messages in the *EXT message queue. Part of the problem is that the information it uses comes from the job's *EXT message queue. Messages can get placed there by anything running in the job. Another part is that you need to look at *DIAG (diagnostic) messages. Those are received in first-in/last-out sequence. The first *DIAG messages in the *EXT message queue may have been placed there hours (or days!) before, depending on how long the job has run. Much more sophistication is possible, but everything has to start from somewhere. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    I’ve tried this MONMSG MSGID(CPF8902)... Since CPF8902 is sent as a *DIAG message, you can't use MONMSG. You can only monitor for *ESCAPE, *STATUS and *NOTIFY messages. For anything else, you need to receive the messages from the appropriate queue. Use the RCVMSG command or the Receive Program Message (QMHRCVPM) API to receive those messages. Tom
    125,585 pointsBadges:
    report
  • Aringarosa
    Hi Tom, thank you for your help. Tell me something, isn't the field dountil ( &MsgId *eq ‘ ‘ ) incomplete?
    295 pointsBadges:
    report
  • TomLiotta
    isn’t the field dountil ( &MsgId *eq ‘ ‘ ) incomplete? No, it's just a little shortened. It tests for the condition where &MsgId equals a blank. The RCVMSG command will return a blank value in the MSGID() parameter when there are no more messages to receive and the WAIT() time is expired. The default WAIT() time is zero. You could put seven blans between the quotes since &MsgId is a 7-byte character variable, but the *EQ condition will happen if it's one blank or seven blanks. I just coded a DOUNTIL for the automatic looping structure. If it runs out of messages, it will drop out of the loop. Tom
    125,585 pointsBadges:
    report
  • Aringarosa
    Thanks very much Tom. I've learned a lot from you. I still have one problem, when i end telnet, i get a full black screen and that job goes up to 60% cpu usage. It never ends telnet. Any clue why it happens. Tanx
    295 pointsBadges:
    report
  • TomLiotta
    I still have one problem, when i end telnet,... Does the same problem show up if you start a new job before calling the program? There is no intelligence in the example code. If, for example, you run the program in a job that has tens of thousands of messages already in the *EXT message queue, it could take a significant amount of time for the program to look through them all. Which "telnet" are you referring to? There are two "telnets" in the job -- you start with the first telnet session, then you call a program that starts a second telnet session to another system. Which one are you ending? How are you ending it? Which system sees "60% cpu usage"? Tom
    125,585 pointsBadges:
    report
  • Aringarosa
    i'm sorry Tom. My mistake, problem solved.
    295 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following