I create the output file in the JCL.
File is used to hold the output from the REXX exec
All return codes show '0'
The final step of the JCL is a file transfer, but the file transfer just sits and waits because the output file is still held by the REXX.
If I cancel the job, then restart the transfer step, the job completes.
change the "ENRICO" with the userid running the test
after the message after the ALLOC RC(0)
logon somewhere else with a different user
use TSO ISRDDN ENQ
and You will see that
Code:
System ENQ Status Row 1 of 1
Command ===> Scroll ===> PAGE
Scroll LEFT or RIGHT to see type or system name.
Major name prefix . . . SYSDSN (SYSDSN, SPFEDIT, etc)
Minor name prefix . . . ENRICO.TEST (dsn etc)
Address id prefix . . . ENRICO (Job name, User id, etc)
System prefix . . . . . (System name)
Major Minor Job Name
┌──────────┬──────────────────────────────────────────────────────┬──────────┐
│ SYSDSN │ ENRICO.TEST.ENQ │ ENRICO │
└──────────┴──────────────────────────────────────────────────────┴──────────┘
hit enter in the <other> session
and after the message after the FREE RC(0) You will see
Code:
System ENQ Status
Command ===> Scroll ===> PAGE
Scroll LEFT or RIGHT to see type or system name.
Major name prefix . . . SYSDSN (SYSDSN, SPFEDIT, etc)
Minor name prefix . . . ENRICO.TEST (dsn etc)
Address id prefix . . . ENRICO (Job name, User id, etc)
System prefix . . . . . (System name)
Major Minor Job Name
┌──────────┬──────────────────────────────────────────────────────┬──────────┐
└──────────┴──────────────────────────────────────────────────────┴──────────┘
if the coding is correct, no outstanding ENQs
... obviously instead of ENRICO You will use and see the userid running the test
/*REXX*/;parse upper arg File1 File2 Rpt1 ;
/*****************************************************************/
/*** ALLOCATE THE OUTPUT FILES, AND ADD A HEADER ROW, THEN' **/
/*** CONVERT THE "@" TO ",'" TO PRESERVE LEADING ZEROS **/
/*** **/
/*** Variable Definitions: **/
/*** **/
/*** FILE1 = CFC867 FCTMP File Name **/
/*** **/
/*** FILE2 = CFC867 Report GDG file **/
/*** **/
/*** rpt1 = CFC867 CA3xR Report Name **/
/*** **/
/*****************************************************************/
/******************<<< R E V I S I O N S >>>******************/
/*****************************************************************/
/* */
/* DATE PROJECT NO. NAME DESCRIPTION */
/* 03/06/2013 13-089 J Diaz New program */
/*****************************************************************/
/**/
/* Main Logic Start Here */
/**/
select
When Rpt1 = 'GA30R' then do
outline1.1 = 'TYPE,GROUP,FA-NO,BETTERMENT-NO,PURC,DESCR,'
outline1.1 = OUTLINE1.1||'MANU,MODEL-NUM,LICENSE-NO,SERIAL-NO,'
outline1.1 = OUTLINE1.1||'ACQ-DATE,ASSET-AMT,LOC,DELIV,RPTG,ORGN'
end
When Rpt1 = 'GA31R' then do
outline1.1 = 'FA-TYPE,FA-GROUP,FA-NUMBER,BETTERMENT-NO,ACQ METHOD,'
outline1.1 =OUTLINE1.1||'DESCR,MANUF,MODEL,LIVENSE-NO,SERIAL-NO,'
outline1.1 =OUTLINE1.1||'ACQ-DATE,DISP-DATE,RPTG,AMT,ORGN,'
outline1.1 =OUTLINE1.1||'DELV-ORGN-TO,LOC-TO'
end
When Rpt1 = 'GA32R' then do
outline1.1 = 'FA-TYPE,FA-GROUP,FA-NUMBER,BETTERMENT-NO,ACQ METHOD,'
outline1.1 =OUTLINE1.1||'DESCR,MANUF,MODEL,LIVENSE-NO,SERIAL-NO,'
outline1.1 =OUTLINE1.1||'ACQ-DATE,DISP-DATE,RPTG,AMT,ORGN,'
outline1.1 =OUTLINE1.1||'DELV-ORGN-TO,LOC-TO'
end
When Rpt1 = 'GA33R' then do
outline1.1 = 'FA-TYPE,FA-GROUP,FA-NUMBER,BETTERMENT-NO,ACQ-METHOD,'
outline1.1 =OUTLINE1.1||'DESCR,MANUF,MODEL,LICENSE-NO,SERIAL-NO,'
outline1.1 =OUTLINE1.1||'XFER-DATE,ACQ-DATE,DISP-DATE,RPTG,AMOUNT,'
outline1.1 =OUTLINE1.1||'ORGN,DELG-ORG-TO,LOC-TO,DELV-ORG-FROM,'
outline1.1 =OUTLINE1.1||'LOC-FROM'
end
end
/**/
/* Allocate Input File */
RealName= GETDSName()
/**/
"ALLOC DA('"||RealName||"') DD(INFILE) SHR"
if rc = 0 then nop
else do
say 'Input File Not Found!!!!!'
rc=555
signal EndIt
end
/**/
/* read the '@' delimited file */
/**/
'EXECIO * DISKR INFILE (STEM CFC867Data. FINIS'
"free DD(INFILE)"
/**/
/* Change "@" to ",'" */
/**/
InCnt=1 /* Skip the line if 'A@A' */
OutCnt1=1 /*headers have already been written. */
do CFC867Data.0
InCnt = InCnt + 1
OutCnt1 = OutCnt1 + 1
OutLine1.OutCnt1 = STRREPLACE(CFC867Data.InCnt,", ",":")
OutLine1.OutCnt1 = STRREPLACE(Outline1.Outcnt1,"@",",'")
end
Signal EndIt
/**/
/**/
/**/
/* All called Subroutines and Functions are located in this section */
/* This isn't a REXX requirement, it just makes maintenance easier */
/* with everything in one place */
/**/
/**/
/* ENDIT is the common exit point the the main exec logic, */
/**/
/**/
EndIt:
/**/
New0=OutCnt1
if words(Outline1.New0) = 1 then do
Outline1.new0 = ''
end
else
nop
/* Allocate output file */
trace ira
Alloc_Name = " FI(VFCFC001) DA('"||File1||"') SHR"
"alloc "||alloc_name
/**/
if rc = 0 then nop
else do
say 'Output File NOT Allocated!!!'
"free all"
rc=555
exit rc
end
'EXECIO * DISKW VFCFC001 (FINIS STEM OUTLINE1. '
say 'EXECIO RC='||rc
"free DD(VFCFC001)"
say 'FREE RC='||rc
exit rc
/**/
GetDSName:
Call outtrap 'stem.'
"listcat ent('" || File2 || "') all"
If rc>0 Then Return 12
Call outtrap 'OFF'
Do a=1 to stem.0
If word(stem.a,1) = "NONVSAM " then DSName=word(stem.a,3)
end
return DSName
/**/
/* A FUNCTION TO DO A STRING REPLACE */
/**/
STRREPLACE:
ORIGINAL = ARG(1)
OLDTXT = ARG(2)
NEWTXT = ARG(3)
/* YOU CAN CHANGE THE BELOW KEY (TMPTXT), WHICH IS USED AS A TEMPORARY
POINTER TO IDENTIFY THE TEXT TO BE REPLACED */
TMPTXT = '6A53CD2EW1F'
NEWSTR = ORIGINAL
DO WHILE POS(OLDTXT,NEWSTR) > 0
NEWSTR = SUBSTR(NEWSTR, 1 , POS(OLDTXT,NEWSTR)-1) ||,
TMPTXT || SUBSTR(NEWSTR, POS(OLDTXT,NEWSTR) + LENGTH(OLDTXT))
END
DO WHILE POS(TMPTXT,NEWSTR) > 0
NEWSTR = SUBSTR(NEWSTR, 1 , POS(TMPTXT,NEWSTR)-1) ||,
NEWTXT || SUBSTR(NEWSTR, POS(TMPTXT,NEWSTR) + LENGTH(TMPTXT))
END
RETURN NEWSTR
By looking at the REXX comment the behavior is what should be expected
and does not depend on alloc/free or REXX...
the ENQ behavior for GDGs is pretty murky there is usually an enq on the GDG base
the problem has been discussed quite a few times on the forum
and if You search the forum it is a normal behavior when FTPing GDGs
allocating by dsname result in an exclusive enq ( OLD )
the proper way is to FTP using the ddname and allocating the input in the JCL
The GDG files are the input into the process. The File1.FCTMP.CFC8670x files are the ones that are transferred, and that's where the issue shows up. The FCTMP files don't appear to be released, at least that's the way it's acting. The file transfer step just sits and waits until I cancel the job
zrc = $alloc("DDNAME", dsname, aparm)
say "after the ALLOC RC("zrc")"
if zrc \= 0 then do
say "alloc error for file" dsname
exit
end
stem.0 = sourceline()
do i = 1 to stem.0
stem.i = sourceline(i)
end
zrc = $tsoex("EXECIO" stem.0 "DISKW DDNAME (STEM STEM. FINIS")
say "after the EXECIO RC("zrc")"
if zrc \= 0 then do
say "EXECIO error for file" dsname
exit
end
zrc = $free("DDNAME")
say "after the FREE RC("zrc")"
if 0 then do
del_0ms = msg("OFF")
Address TSO "DELETE 'ENRICO.TEST.ENQ'"
del_0rc = rc
z = msg(del_0ms)
say "after the DELETE RC("RC")"
end
Exit 0
/* */
novalue:
say "*********************************"
say "** **"
say "** novalue trapped at line" || right(sigl,4) || " **"
say "** **"
say "*********************************"
exit
zrc = $alloc("DDNAME", dsname, aparm)
say "after the ALLOC RC("zrc")"
if zrc \= 0 then do
say "alloc error for file" dsname
exit
end
stem.0 = sourceline()
do i = 1 to stem.0
stem.i = sourceline(i)
end
zrc = $tsoex("EXECIO" stem.0 "DISKW DDNAME (STEM STEM. FINIS")
say "after the EXECIO RC("zrc")"
if zrc \= 0 then do
say "EXECIO error for file" dsname
exit
end
zrc = $free("DDNAME")
say "after the FREE RC("zrc")"
if 0 then do
del_0ms = msg("OFF")
Address TSO "DELETE 'ENRICO.TEST.ENQ'"
del_0rc = rc
z = msg(del_0ms)
say "after the DELETE RC("RC")"
end
Exit 0
/* */
novalue:
say "*********************************"
say "** **"
say "** novalue trapped at line" || right(sigl,4) || " **"
say "** **"
say "*********************************"
exit
It's probably something with the file transfer product itself. There have been issues before, that have caused us to split the transfer out into a seperate job, because 'something' in the job was holding the dataset that wouldn't let the transfer process begin.