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.


Topics - athomason

Pages: [1]
1
We wrote a JES2 exit based on z/OS PSF sample exit 15 (APSUX15X) to capture WTRID in the "extra data" sent to CMOD via the PSF MVS Download FSS procedure.  I found an AIX sample "writer_rename" in documentation but since there was nothing for windows, I'd like to provide it as a sample if anyone can use it.


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::  NAME:                                                                                       ::   
::   mvsd_wtr_rename.bat                                                                     ::
::                                                                                              ::
::  DESCRIPTION:                                                                                ::
::   This windows batch script is designed as a exit routine to be executed by               ::
::   the ARSJESD program after a file has been downloaded from z/OS to a windows             ::
::      server running CMOD.  This script parses the additional job options that were sent by   ::
::      PSF sample exit APSUX15 and renames the file name by using the value of the             ::
::   WRITER parameter.                                                                       ::
::  CHANGE LOG:                                                                                 ::
::      New batch script.                                                 AThomason 21MAY18     ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::2 variables passed from MVSD:                                                                 ::
::   %1 = pathname and filename in the format:                                                  ::
::        "[drive letter]:\Path\system.jobname[.step][.form].[cc]yyddd.time.ext"                ::
::   %2 = extra options passed from PSF exit APSUX15 on z/OS:                                   ::
::       "-odatat=line -ofileformat=record -occ=xxx -occtype=x -oburst=xx -ocop=xxx             ::
::        -odatac=xxxxx -ojobn=xxxxxxxx -ous=uuuuuuu -ono=xxxxxxx -opr=xxxxxxxxxxx   -oro=xxxx  ::
::        -opa=forms=xxx,class=x,destination=xxxxx,jobid=xxxxxxxx,wtrid=xxxxxxxx "              ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SET var1=%1
SET var2=%2

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Strip quotes from beginning and ending of %var1% and %var2%                                   ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set var1=%var1:"=%
set var2=%var2:"=%

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Parse var1 (using \ as delimeter)                                                             ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /f "tokens=1-5 delims=\" %%a IN ("%var1%") DO (
set t1=%%a
set t2=%%b
set t3=%%c
set t4=%%d
set t5=%%e)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Parse last variable (using . as delimiter) from previous parse to split up the filename       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /f "tokens=1-7 delims=." %%a IN ("%t5%") DO (
set u1=%%a
set u2=%%b
set u3=%%c
set u4=%%d
set u5=%%e
set u6=%%f
set u7=%%g)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Parse var2 (using - as delimiter) to split up the optional parms                              ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /f "tokens=1-13 delims=-" %%a IN ("%var2%") DO (
set v1=%%a
set v2=%%b
set v3=%%c
set v4=%%d
set v5=%%e
set v6=%%f
set v7=%%g
set v8=%%h
set v9=%%i
set v10=%%j
set v11=%%k
set v12=%%l
set v13=%%m)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Parse v13 (using ,) to isolate the parms split by the previous parse (wtrid is token 5)       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /f "tokens=1-5 delims=," %%a IN ("%v13%") DO (
set w5=%%e)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Parse w5 (using =) to isolate writerid from "writerid="                                       ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /f "tokens=1-2 delims==" %%a IN ("%w5%") DO (
set x2=%%b)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Remove trailing blank(s) from x2 (writerid)                                                   ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set x2=%x2: =%

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Rebuild PATH, FILENAME, and build NEW FILENAME by replacing the third node with x2 (writerid) ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set pathname=%t1%\%t2%\%t3%\%t4%\
set begfile=%u1%.%u2%.%u3%.%u4%.%u5%.%u6%.%u7%
set endfile=%u1%.%u2%.%x2%.%u4%.%u5%.%u6%.%u7%

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Execute windows commands to change directories and rename the file                            ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
cd %pathname%
ren %begfile% %endfile%

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Write output to a log file                                                                    ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo %date%_%time%  %pathname%   %begfile%      %endfile%>>C:\temp\mvsd_wtr_rename.log

Pages: [1]