0

I would like to know,is it possible to invoke DFSORT through REXX? I have used the below code,but the result is not as expected.

/*REXX*/
QUEUE "//ISDNNNN JOB XXX,XX"
QUEUE"//STEP003 EXEC PGM=SORT"
"FREE FI(SYSOUT SORTIN SORTOUT)"
"ALLOC FI(SYSOUT) DA(*)"
"ALLOC FI(SORTIN) DA('XXX.XXX.XXX') REUSE'
"ALLOC FI(SORTOUT) DA('XXX.XXX.XXX.OUT') REUSE'
QUEUE"//SYSIN DD*"
" SORT FIELDS = COPY"
" INCLUDE COND = (1,2,CH,EQ,C'AR')"
QUEUE"/*"
QUEUE"//SYSPRINT DD SYSOUT=*"
QUEUE"$$"
"SUBMIT * END($$)"
MCN
  • 83
  • 1
  • 7
  • 2
    Your sysin statement is wrong - you need a space between the DD and the *. there may be other problems but as you did not show us your error messages I cannot tell. – NicC Jul 09 '18 at 08:58
  • 1
    Please provide some clarification. What was the result? Were there error messages? – meat Jul 09 '18 at 11:20
  • 1
    You need to queue JCL for SYSOUT, SORTIN, SORTOUT as you seem to be tring to run a batch job. Without that your job woulld consist of: job statement, exec statement, a malformed sysin statement and a sysprint statement. You do not need SYSPRINT and SYSOUT. refer to the DFSort manual for the correct JCL to use. – NicC Jul 11 '18 at 11:42
  • 1
    The simple answer to your question is "yes". However, when working with REXX, you need to simulate what JCL does. In a TSO environment, you need to issue ALLOCATE statements for each data set, analogous to what would appear in a JCL step. – zarchasmpgmr Jul 12 '18 at 22:14

2 Answers2

3

Yes it is possible.
Basically You can:

  • If running under ISPF, you can ISPF File Tailoring. Here is a sample File Tailoring skelton
  • You can call SORT directly
  • write a file and submit it, like you are trying to do. What is happening and what did you expect ???. I do not have a mainframe to test your code.

I would suggest learning the ISPF services i.e.

Rexx:

ADDRESS TSO "ALLOC DD(OUTSKEL) DS('"OUTSKPDS"') SHR"
'FTOPEN'
'FTINCL SAMPSKEL'
'FTCLOSE LIBRARY(OUTSKEL) NAME('WORKMEM')'

Sample ISPF Skelton:

//ASM    EXEC  PGM=IFOX00,REGION=128K
//             PARM=(&ASMPARMS)
//SYSIN    DD  DSN=&ASMIN(&MEMBER),DISP=SHR
//SYSLIB   DD  DSN=SYS1.MACLIB,DISP=SHR
)SEL  &ASMMAC1 ¬= &Z
//         DD  DSN=&ASMMAC1,DISP=SHR
)SEL  &ASMMAC2 ¬= &Z
//         DD  DSN=&ASMMAC2,DISP=SHR
)ENDSEL
)ENDSEL
//SYSUT1   DD  UNIT=SYSDA,SPACE=(CYL,(5,2))
//SYSUT2   DD  UNIT=SYSDA,SPACE=(CYL,(2,1))
//SYSUT3   DD  UNIT=SYSDA,SPACE=(CYL,(2,1))
//SYSPRINT DD  SYSOUT=(&ASMPRT)
)CM   IF USER SPECIFIED "GO," WRITE OUTPUT IN TEMP DATA SET
)CM   THEN IMBED "LINK AND GO" SKELETON
)IF  &GOSTEP = YES THEN )DO
//SYSGO    DD  DSN=&&&&OBJSET,UNIT=SYSDA,SPACE=(CYL,(2,1)),
//             DISP=(MOD,PASS)
)IM   LINKGO
)ENDDO
)CM   ELSE (NOGO), WRITE OUTPUT TO USER DATA SET
)ELSE )DO
//SYSGO    DD  DSN=&ASMOUT(&MEMBER),DISP=OLD
)ENDDO
Kevin McKenzie
  • 627
  • 3
  • 18
Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
-1

you can alloc the necessary files under address tso for example "alloc f(sortin) da(....) shr " the call sort under address ispling: address ispling " sort " Be aware to put control cfards in the sysin file

Gad Barth
  • 11
  • 1