29
Fri, Nov
0 New Articles

Let Users Display Their Submitted Jobs

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Users can check on jobs without compromising security.

Anxiety is what users experience when they submit a job to batch processing and it doesn't complete in the time they think it should take. In this case, users will probably call IS, asking what's going on. Another form of anxiety is the one that you'll experience when one of your users submits the same job for the second time only because he thought the first submission didn't "take," in many cases resulting in the failure of both jobs when they try to allocate the same files.

IBM gave us the Work with Submitted Jobs (WRKSBMJOB) command, as if you should allow your users to run it. This command, however, not only provides a command line (making many IS administrators nervous) but it also allows the user to run a number of options on each job-such as 2 to change or 4 to end. Even if you limit a user's capabilities to prevent him from running commands from the command line, he can still execute the change or end options from the WRKSBMJOB panel. This is not good for shops that are concerned with tight security.

Instead of training a few users how to run the Work with User Jobs (WRKUSRJOB) or Work with Subsystem Jobs (WRKSBSJOB) command, you should devise a method which lets your end users see their submitted jobs by themselves without the risk of changing anything. This not only reduces congestion in your IS telephone lines; it does away with some of the irritation of your IS personnel, as well. Plus, if you make it easy to use, you won't spend any time at all training your users. So here's the Display Submitted Jobs (DSPSBMJOB) command, which I list in 1.

Instead of training a few users how to run the Work with User Jobs (WRKUSRJOB) or Work with Subsystem Jobs (WRKSBSJOB) command, you should devise a method which lets your end users see their submitted jobs by themselves without the risk of changing anything. This not only reduces congestion in your IS telephone lines; it does away with some of the irritation of your IS personnel, as well. Plus, if you make it easy to use, you won't spend any time at all training your users. So here's the Display Submitted Jobs (DSPSBMJOB) command, which I list in Figure 1.

There's really not much to developing it-I was surprised. All it takes is running the WRKSBMJOB command to *PRINT, capturing this printout into a database file and giving this file to an RPG program to display with an output-only subfile. I'm using CL program SBM002CL (2), display file SBM002DF (3) and RPG program SBM002RG (4).

There's really not much to developing it-I was surprised. All it takes is running the WRKSBMJOB command to *PRINT, capturing this printout into a database file and giving this file to an RPG program to display with an output-only subfile. I'm using CL program SBM002CL (Figure 2), display file SBM002DF (Figure 3) and RPG program SBM002RG (Figure 4).

DSPSBMJOB has four parameters that add flexibility to the command. JOBQ: Whether to include jobs that are still in a job queue. This includes jobs with a status of JOBQ, SCD (scheduled), TFRBCH and TFRJOB (transferred). Defaults to *YES.

ACTIVE: Whether to include jobs that are currently running. This lists jobs with a status of ACTIVE, DSC (disconnected) and MSGW (message waiting). Defaults to *YES.

OUTQ: Whether to include jobs that have processed and produced printed output, although the output hasn't printed yet. Defaults to *NO.

END: Whether to include jobs that have ended. It includes jobs with a status of END (ended with ENDJOB), FIN (printed output already printed) and EOJ (ended by any other means). Defaults to *NO.

So now your operator can get back to running the computer and your programmers can enjoy their evenings with their families, because your users can independently check the status of the jobs they have submitted-without compromising security.

Editor's Note: Remember that this command only displays jobs that have been submitted to batch. Users will not see any job information for their interactive jobs with this command.

Bruce Knoll is a programmer/analyst at Lescoa, Inc. in Grand Rapids, MI. He has worked on the midrange platforms for more than eight years.


Let Users Display Their Submitted Jobs

Figure 1 Command DSPSBMJOB

 DSPSBMJOB: CMD PROMPT('Display Submitted Jobs') PARM KWD(JOBQ) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*YES) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include jobs in job queue') PARM KWD(ACTIVE) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*YES) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include active in job queue') PARM KWD(OUTQ) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*NO) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include jobs in output queue') PARM KWD(END) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*NO) VALUES(*YES *NO) EXPR(*YES) + PROMPT('Include ended jobs') 
Let Users Display Their Submitted Jobs

Figure 2 CL Program SBM002CL

 SBM002CL: + PGM PARM(&JOBQ &ACTIVE &OUTQ &END) DCL VAR(&ACTIVE) TYPE(*CHAR) LEN(4) DCL VAR(&END) TYPE(*CHAR) LEN(4) DCL VAR(&JOBQ) TYPE(*CHAR) LEN(4) DCL VAR(&OUTQ) TYPE(*CHAR) LEN(4) DCL VAR(&REFRESH) TYPE(*CHAR) LEN(1) IF COND(&JOBQ *EQ '*NO' *AND &ACTIVE *EQ '*NO' *AND &OUTQ *EQ + '*NO' *AND &END *EQ '*NO') THEN(DO) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('At least one + parameter must be *YES') MSGTYPE(*ESCAPE) RETURN ENDDO OVRPRTF FILE(QPDSPSBJ) HOLD(*YES) CRTPF FILE(QTEMP/DSPJOB) RCDLEN(132) MONMSG MSGID(CPF0000) REPEAT: + SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Gathering data. + Please wait') TOPGMQ(*EXT) MSGTYPE(*STATUS) WRKSBMJOB SBMFROM(*USER) OUTPUT(*PRINT) CPYSPLF FILE(QPDSPSBJ) TOFILE(QTEMP/DSPJOB) JOB(*) SPLNBR(*LAST) + TOMBR(*FIRST) MBROPT(*REPLACE) DLTSPLF FILE(QPDSPSBJ) JOB(*) SPLNBR(*LAST) CALL PGM(SBM002RG) PARM(&JOBQ &ACTIVE &OUTQ &END &REFRESH) IF COND(&REFRESH *EQ 'Y') THEN(GOTO CMDLBL(REPEAT)) ENDPGM 
Let Users Display Their Submitted Jobs

Figure 3 Display File SBM002DF

 A DSPSIZ(24 80 *DS3) A PRINT A CA03(03 'Exit') A CA05(05 'Refresh') A CA12(12 'Cancel') A R SFLRCD SFL A SFJOB 10A O 4 2 A SFJOB# 6A O 4 15 A SFSTSA 6A O 4 24 A SFSTSB 10A O 4 32 A SFFUNC 35A O 4 44 A R SFLCTL SFLCTL(SFLRCD) A BLINK OVERLAY A N51 SFLDSP A N51 AON53 SFLDSPCTL A 51 AON53 SFLCLR A N60 SFLEND A SFLSIZ(36) SFLPAG(18) A 1 31'Submitted Jobs List' DSPATR(HI) A 1 72DATE EDTCDE(Y) A 2 72TIME A 1 2'User:' A USER 10A O 1 8 A 3 2'Job Name' DSPATR(HI) A 3 15'Job #' DSPATR(HI) A 3 24'Status' DSPATR(HI) A 3 44'Function' DSPATR(HI) A R FKEYS A LOCK A 23 2'F3=Exit F5=Refresh F12=Cancel' A COLOR(BLU) 
Let Users Display Their Submitted Jobs

Figure 4 RPG Program SBM002RG

 FSBM002DFCF E WORKSTN F SFLINEKSFILE SFLRCD FDSPJOB IF F 132 DISK E JQT 4 4 6 E ACT 4 4 6 E OUT 1 1 6 E ENT 3 3 6 IDSPJOB NS I 4 13 JOB I 30 35 JOB# I 49 54 STSA I 58 66 STSB I 68 100 FUNC ISDS SDS I 254 263 USER C *ENTRY PLIST C PARM JOBQ 4 C PARM ACTIVE 4 C PARM OUTQ 4 C PARM END 4 C PARM F5 1 C WRITEFKEYS C MOVE *ON *IN53 C MOVE *ON *IN51 C WRITESFLCTL Clear subfile C MOVE *OFF *IN51 C Z-ADD0 SFLINE 30 C *IN99 DOUEQ*ON C READ DSPJOB 99 C *IN99 IFEQ *OFF C MOVEL*OFF *IN50 C JOBQ IFEQ '*YES' C STSA LOKUPJQT 50 C ENDIF C *IN50 IFEQ *OFF C ACTIVE ANDEQ'*YES' C STSA LOKUPACT 50 C ENDIF C *IN50 IFEQ *OFF C OUTQ ANDEQ'*YES' C STSA LOKUPOUT 50 C ENDIF C *IN50 IFEQ *OFF C END ANDEQ'*YES' C STSA LOKUPENT 50 C ENDIF C *IN50 IFEQ *ON C MOVELJOB SFJOB C MOVELJOB# SFJOB# C MOVELSTSA SFSTSA C MOVELSTSB SFSTSB C MOVELFUNC SFFUNC C ADD 1 SFLINE C WRITESFLRCD C ENDIF C ENDIF C ENDDO C SFLINE IFLT 1 C ADD 1 SFLINE C MOVEL'(None)' SFJOB P C WRITESFLRCD C ENDIF C EXFMTSFLCTL C *IN05 IFEQ *ON C MOVE 'Y' F5 C ELSE C MOVE 'N' F5 C ENDIF C MOVE *ON *INLR C RETRN ** JOBQ SCD TFRBCHTFRJOB ** ACTIVEDSC MSGW JOBLOG ** OUTQ ** END EOJ FIN 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: