Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using ICETOOL to Copy Tape Files in a REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Wed Feb 22, 2012 6:01 pm    Post subject: Using ICETOOL to Copy Tape Files in a REXX
Reply with quote

Hello All -
I am a newcomer to REXX and am in the process of writing a simple REXX procedure which reads a list of files which shall be copied over as tape files, making a copy of the file in tape format as each file name gets read.

I am using DFSORT/ICETOOL to effect the copying over to tape format. The problem is that it doesn't work even though I find no errors in TOOLMSG and DFSMSG and get a RC=00. The new (copied) file is not allocated.

In the course of testrunning I have discovered that when the SORTOUT data exists as part of JCL code (the REXX being invoked from IKJEFT01), then the new (copied) file DOES get allocated (see under):

//COPYOUT DD DSN=TAPEFILE.NEW.COPYOUT,
// DISP=(NEW,CATLG,DELETE),
// UNIT=VSM12,LABEL=RETPD=500

But when the COPYOUT DD data (as seen above) takes the form of a record in a file (placed there by REXX), then no new file is copied even though RC = 00 (see under)

//COPYOUT DD DSN=TAPEFILE.ALOCDATA.COPYOUT,DISP=OLD

Here the file data takes the form of a single line/record with all the file allocation data as shown in the first example followed by a blank line/record (a NULL record in REXX which signals EOF).

I need the COPYOUT data as a file instead of as JCL DD data because the REXX inserts this COPYOUT data into the file after each file name is read prior to running the ICESORT copy process.

I am willing to run the REXX from a JCL, though I would prefer to invoke it from TSO or ISPF.

Any help or suggestions are greatly appreciated !
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Wed Feb 22, 2012 6:06 pm    Post subject:
Reply with quote

Quote:
I am willing to run the REXX from a JCL, though I would prefer to invoke it from TSO or ISPF.
Are you aware that most sites prevent allocation of tape drives to TSO users?
Back to top
View user's profile Send private message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Wed Feb 22, 2012 6:18 pm    Post subject:
Reply with quote

Will I be OK then if I stick to JCL ?

As I have noted above, the copy works under certain conditions when I run the REXX / ICETOOL via JCL.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Feb 22, 2012 8:24 pm    Post subject: Reply to: Using ICETOOL to Copy Tape Files in a REXX
Reply with quote

Quote:
But when the COPYOUT DD data (as seen above) takes the form of a record in a file (placed there by REXX), then no new file is copied even though RC = 00 (see under)


Your process is not clearly explained. Are the DD statements part of the submitted JCL or not? If they are part of a different file, then they will not be considered part of the JCL and will not get 'executed' when the job is submitted.

Please show an example.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 22, 2012 8:32 pm    Post subject: Reply to: Using ICETOOL to Copy Tape Files in a REXX
Reply with quote

1) are You generating the jcl thru rexx submitting it afterwards
2) or are You invoking SORT from rexx after the proper allocations ?

for case 1 You might meditate about a SORT only approach
quite a few examples on how to build jcl based on a dataset list
( search the forum)

worth also to read

ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
Viktor

New User


Joined: 12 Nov 2010
Posts: 7
Location: Europe

PostPosted: Thu Feb 23, 2012 1:35 am    Post subject:
Reply with quote

Hello Pedro and Enrico-S -
Sorry about the lack of detail in my explanation, my employer does not allow the copy of data, pics etc. from work environment to public internet and vice-versa.

I must log on privately to show an example. Here is an example of what DOES NOT WORK:
Code:
//STEP090  EXEC PGM=IKJEFT01                                           
//SYSEXEC  DD DSN=QSYST1A.DEV230.EXEC,DISP=SHR                         
//SYSTSPRT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//TOOLMSG  DD DSN=QSYST1A.VERX.TOOLMSG,DISP=OLD                         
//DFSMSG   DD DSN=QSYST1A.VERX.DFSMSG,DISP=OLD                         
//SORTLIB  DD DSN=QSYST1A.VERX.SORTLIB,DISP=OLD                         
//DISC     DD DSN=QSYST1A.VERX.DISC,DISP=OLD                           
//BLNKCNTL DD DSN=QSYST1A.VERX.BLNKCNTL,DISP=OLD                     
//TOOLIN   DD DSN=QSYST1A.VERX.TOOLIN,DISP=OLD                         
//COPYIN   DD DSN=QSYST1A.VERX.SORTIN,DISP=OLD                         
//COPYOUT  DD DSN=QSYST1A.DSN=TAPEFILE.ALOCDATA.COPYOUT,DISP=OLD
//SYSTSIN  DD *                                                         
P355CGDG                                                           
/*             

While here is an example of what DOES WORK:

Code:
//STEP090  EXEC PGM=IKJEFT01                                           
//SYSEXEC  DD DSN=QSYST1A.DEV230.EXEC,DISP=SHR                         
//SYSTSPRT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//TOOLMSG  DD DSN=QSYST1A.VERX.TOOLMSG,DISP=OLD                         
//DFSMSG   DD DSN=QSYST1A.VERX.DFSMSG,DISP=OLD                         
//SORTLIB  DD DSN=QSYST1A.VERX.SORTLIB,DISP=OLD                         
//DISC     DD DSN=QSYST1A.VERX.DISC,DISP=OLD                           
//BLNKCNTL DD DSN=QSYST1A.VERX.BLNKCNTL,DISP=OLD                                       
//TOOLIN   DD DSN=QSYST1A.VERX.TOOLIN,DISP=OLD                         
//COPYIN   DD DSN=QSYST1A.VERX.SORTIN,DISP=OLD                         
//COPYOUT  DD DSN=QSYST1A.TAPEFILE.NEW.COPYOUT,                         
//         DISP=(,CATLG,DELETE),UNIT=VSM12,LABEL=RETPD=500
//SYSTSIN  DD *                                                         
P355CGDG                                                               
/*

Enrico-S: So in these examples the REXX is invoked from IKJEFT01. The REXX in turn invokes the DFSORT/ICETOOL. My plan is that the file defined in COPYOUTwill be changed every time the REXX list-read loop is incremented by one.

Is it possible to generate a new JCL COPYOUT DD statement via REXX? Wouldn't I basically have to generate a new job via REXX (and then run it) for every file on the list to be copied ?

Pedro: Your statement agrees with the results I have been getting: that is if my DD statements 'are part of a different file, then they will not be considered part of the JCL and will not get 'executed' when the job is submitted.'

I gather that I would be able to have my DD statements as ICETOOL files and not part of the JCL (and run from TSO/ISPF), but then I would need to have Tape Mount Authority ?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 23, 2012 3:06 am    Post subject: Reply to: Using ICETOOL to Copy Tape Files in a REXX
Reply with quote

telling does not work and posting nothing useful will not get You any answers, it will just piss off people willing to help icon_evil.gif

if You want real help post the REXX script so that we can see what is going on inside

this snippet works


Code:
 EDIT       ENRICO.ISPF.EXEC(ICECOPY) - 01.12               Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR 
 ****** ***************************** Top of Data ******************************
 000001 /*REXX */                                                               
 000002 Trace "O"                                                               
 000003 call $tsoex "EXECIO * DISKR FILELIST ( FINIS STEM FILES. "             
 000004 do  f = 1 to files.0                                                   
 000005                                                                         
 000006     sortin = "'"strip(files.f)"'"                                       
 000007     if  listdsi(sortin) \= 0 then do                                   
 000008         say "input file not found" sortin                               
 000009         iterate                                                         
 000010     end                                                                 
 000011     aparm = "SHR REUSE"                                                 
 000012     if  $alloc("SORTIN", sortin, aparm) \= 0 then do                   
 000013         say "alloc error for file" sortin                               
 000014         iterate                                                         
 000015     end                                                                 
 000016     sysout = "'"strip(sortin,,"'")".COPY.SYSOUT'"                       
 000017     if listdsi(sysout) = 0 then ,                                       
 000018        aparm = "SHR REUSE"                                             
 000019     else ,                                                             
 000020        aparm = "SPACE(2 2) TRACKS UNIT(SYSDA) " || ,                   
 000021                "DSORG(PS) RECFM(F B) LRECL(133) " || ,                 
 000022                "NEW CATALOG "                                           
 000023     if  $alloc("SYSOUT", sysout, aparm) \= 0 then do                   
 000024         say "alloc error for file" sysout                               
 000025         call $tsoex "FREE FI(SORTIN)"                                   
 000026         iterate                                                         
 000027     end                                                                 
 000028                                                                         
 000029     sortout = "'"strip(sortin,,"'")".COPY'"                             
 000030     if listdsi(sortout) = 0 then ,                                     
 000031        aparm = "SHR REUSE"                                             
 000032     else ,                                                             
 000033        aparm = "LIKE("sortin") NEW CATALOG "                           
 000034     if  $alloc("SORTOUT", sortout, aparm) \= 0 then do                 
 000035         say "alloc error for file" sortout                             
 000036         call $tsoex "FREE FI(SYSOUT)"                                   
 000037         call $tsoex "FREE FI(SORTIN)"                                   
 000038         iterate                                                         
 000039     end                                                                 
 000040                                                                         
 000041     Address LINKMVS ICEMAN                                             
 000042     say                                                                 
 000043     say "RC("RC")for     file" sortin                                   
 000044 end                                                                     
 000045 Exit 0                                                                 
 000046                                                                         
 000047 /* */                                                                   
 000048 $tsoex:                                                                 
 000049    tso_0tr = trace("O")                                                 
 000050    Address TSO arg(1)                                                   
 000051    tso_0rc = rc                                                         
 000052    trace value(tso_0tr)                                                 
 000053    return tso_0rc                                                       
 000054 /* */                                                                   
 000055 $alloc:procedure                                                       
 000056    alc_0tr = trace("O")     
 000057    alc_0ms = msg("OFF")
 000058    parse upper arg ddnm, dsnm, misc                                     
 000059    ddnm = strip(ddnm)                                                   
 000060    dsnm = strip(dsnm)                                                   
 000061    dsnm = strip(dsnm,,"'")                                             
 000062    dsnm = "DA('"dsnm"') "                                               
 000063    misc = space(misc)                                                   
 000064    Address TSO "FREE  FI("ddnm") "                                     
 000065    Address TSO "ALLOC FI("ddnm") " dsnm misc                           
 000066    alc_0rc = rc     
 000067    z = msg(alc_0ms)   
 000067    trace value(alc_0tr)                                                 
 000069    Return alc_0rc                                                       
 ****** **************************** Bottom of Data ****************************


jcl

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB (ACCT#),'ICECOPY',NOTIFY=ENRICO,                         
 000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)                       
 000003 //*                                                                     
 000004 //*                                                                     
 000005 //IKJ     EXEC PGM=IKJEFT01,PARM='ICECOPY'                             
 000006 //SYSEXEC   DD DISP=SHR,DSN=ENRICO.ISPF.EXEC                           
 000007 //SYSTSPRT  DD SYSOUT=*                                                 
 000008 //SYSPRINT  DD SYSOUT=*                                                 
 000009 //SYSTSIN   DD DUMMY                                                   
 000010 //SYSIN     DD DISP=SHR,DSN=ENRICO.ICE.SYSIN                           
 000011 //FILELIST  DD *                                                       
 000012 ENRICO.ICE.FB80                                                         
 000013 ENRICO.ICE.FB133                                                       
 000014 ENRICO.ICE.VB255                                                       
 ****** **************************** Bottom of Data ****************************


the SYSIN dataset contains just one record ( starting at column 2
Code:
  OPTION COPY
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu Feb 23, 2012 3:34 am    Post subject: Reply to: Using ICETOOL to Copy Tape Files in a REXX
Reply with quote

Enrico's example shows that allocations in rexx are done through the use of TSO ALLOCATE statements.

The JCL is processed by the system before the program specified on PGM= is called. The rexx or any other program cannot dynamically create other JCL to be run as part of the same step. Except they can use TSO ALLOCATE or dynamic allocation SVC.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1717
Location: UK

PostPosted: Thu Feb 23, 2012 12:59 pm    Post subject:
Reply with quote

Unless you specify otherwise, SORT uses SORTIN/SORTOUT as it input/output datasets.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us