IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX for backing up datasets with a date


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Fri Feb 19, 2010 2:09 pm
Reply with quote

As a result of this topic, I'm trying to make a temporary fix for backing up a few (VSAM) datasets, using a REXX script to generate and submit a JCL job.
The backed up dataset should contain a date as the lowest qualifier.

REXX code:
Code:
date = DATE('S')                                                     
queue "//MYJOB JOB (...,...,...,...),...,CLASS=X"       
queue "//STEP1  EXEC  PGM=ADRDSSU,REGION=2048K"                     
queue "//SYSPRINT DD  SYSOUT=*"                                     
queue "//OUTVOL1  DD  VOL=SER=VOL001,UNIT=SYSDA,DISP=SHR"           
queue "//SYSIN    DD  *"                                             
queue " COPY DATASET(INCLUDE(SOME.DATASET)) -" 
queue "      CANCELERROR -"                                         
queue "      OUTDDNAME(OUTVOL1) -"                                   
queue "      PERCENTUTILIZED(100) -"                                 
queue "      CATALOG -"                                             
queue "      RENAMEUNCONDITIONAL( -"                                 
queue "        (SOME.DATASET, -"               
queue "         SOME.DATASET." !! date !! ")) -"
queue "      TGTALLOC(SOURCE) -"                                     
queue "      TOL(ENQF) -"                                           
queue "      FASTREP(PREF) -"                                       
queue "      WAIT(2,2)"                                             
queue "/*"                                                           
ADDRESS TSO                                                         
"ALLOC F(JCL) SYSOUT WRITER(INTRDR)"                                 
"EXECIO" QUEUED() "DISKW JCL (FINIS"                                 
"FREE F(JCL)"


When looking at the MYJOB output, it seems there's a synthax error. I guess the REXX script is using the date variable in wrong way.. Please advise.

Also, an idea for a better solution is welcome. icon_smile.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Feb 19, 2010 2:20 pm
Reply with quote

Ivan P wrote:
When looking at the MYJOB output, it seems there's a synthax error. I guess the REXX script is using the date variable in wrong way.. Please advise.
Please post you output with the syntax error.....
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Feb 19, 2010 2:22 pm
Reply with quote

Hi,

just from looking your concatenation looks incorrect
Code:
!!  should be ||
ie. HEX 4F4F

Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Feb 19, 2010 2:25 pm
Reply with quote

Hi,

also a qualifier in the dataset name containing all numerics will not work.

date variable contains all numerics


Gerry
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Fri Feb 19, 2010 2:32 pm
Reply with quote

The relevant part of the MYJOB output:
Code:
IEC141I 013-20,IGG0199G,MYJOB,STEP1,SYSIN                         
IEA995I SYMPTOM DUMP OUTPUT                                           
SYSTEM COMPLETION CODE=013  REASON CODE=00000020                     
 TIME=09.57.06  SEQ=12645  CPU=0000  ASID=003E                       
 PSW AT TIME OF ERROR  075C1000   80E1005E  ILC 2  INTC 0D           
   NO ACTIVE MODULE FOUND                                             
   NAME=UNKNOWN                                                       
   DATA AT PSW  00E10058 - 41003B7A  0A0D41F0  38BE56F0               
   AR/GR 0: 9E1B3EDE/00000000_00E10324   1: 00000000/00000000_A4013000
         2: 00000000/00000000_001F0C20   3: 00000000/00000000_00E0F7AA
         4: 00000000/00000000_007C1410   5: 00000000/00000000_007C17A4
         6: 00000000/00000000_007C174C   7: 00000000/00000000_007C17A4
         8: 00000000/00000000_007C176C   9: 00000000/00000000_007C7028
         A: 00000000/00000000_00000001   B: 00000000/00000000_00000001
         C: 00000000/00000000_007C177C   D: 00000000/00000000_00E08BEE
         E: 00000000/00000000_80E0F8E2   F: 00000002/00000010_00000020
 END OF SYMPTOM DUMP                                                 
IEF142I MYJOB STEP1 - STEP WAS EXECUTED - COND CODE 0012
....
PAGE 0001     5695-DF175  DFSMSDSS V1R09.0 DATA SET SERVICES     2010.050 09:57                           
ADR013I (SCH)-DSSU (01), 2010.050 09:57:06 TASK ABENDED WITH SYSTEM ABEND CODE 0013                       
ADR012I (SCH)-DSSU (01), 2010.050 09:57:06 DFSMSDSS PROCESSING COMPLETE. HIGHEST RETURN CODE IS 0012 FROM:
                         SYNTAX 


Gerry, after changing !! to ||, the output of the ISPSTART command (which I'm using to run REXX at the moment) was:
Code:
READY                                                               
 ISPSTART CMD(%MYREXX)                                             
    14 +++  queue "         SOME.DATASET." |   
     1 +++ date = DATE('S')                                         
IRX0013I Error running MYREXX, line 14: Invalid character in program
ISPD117                                                             
The initially invoked CLIST ended with a return code = 20013       
 MYUSER.SPFLOG1.LIST has been kept.                               
READY                                                               
END


After adding a "D" before date variable concatenation, output remains the same..
Code:
queue "         SOME.DATASET.D" !! date !! ")) -"
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 2:41 pm
Reply with quote

Quote:
After adding a "D" before date variable concatenation, output remains the same..
Code:
Code:
queue "         SOME.DATASET.D" !! date !! ")) -"


Still I see ! not |
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Fri Feb 19, 2010 2:46 pm
Reply with quote

Sambhaji, using | instead of !, gives the message described in my previous post, before the part about adding a non-numeric character.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 19, 2010 2:50 pm
Reply with quote

Have you looked at the IEC141I message to tell you what the problem is.

Also, for the discussion of the concatenation character, depending on the language setup of the ISPF session, ! is sometimes used in place of |. Where I am now I use ! rather than |
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Fri Feb 19, 2010 2:59 pm
Reply with quote

Yes.
Code:
IEC141I 013-20,IGG0199G,MYJOB,STEP1,SYSIN

Meaning there was an error in processing the module IGG0199G with RC 20, in job MYJOB, step STEP1, DD statement SYSIN.

Description of RC 20:
IBM wrote:
An OPEN macro instruction was issued for a sequential data set using queued access. BLKSIZE is not a multiple of LRECL, or LRECL is 0 with RECFM=FB or RECFM=FBS, or BLKSIZE is not at least four bytes greater than LRECL with RECFM=V.
Which doesn't make much sense to me, since running the job outside REXX (without using the date function) works..
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Feb 19, 2010 3:06 pm
Reply with quote

Ivan P wrote:
Which doesn't make much sense to me, since running the job outside REXX (without using the date function) works..

Yes, it would work outside of REXX when submitted from a JCL library.
A little food for thought. I have my suspiscions of what is causing the problem. Anyway, off for a meeting now, oh deep joy icon_rolleyes.gif , and will share them after I get back.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1315
Location: Vilnius, Lithuania

PostPosted: Fri Feb 19, 2010 4:54 pm
Reply with quote

gcicchet wrote:
Hi,

just from looking your concatenation looks incorrect
Code:
!!  should be ||
ie. HEX 4F4F


The values are quite likely correct, but x'4F' does not display code-page invariant...
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Fri Feb 19, 2010 6:33 pm
Reply with quote

instead of writing to a the internal reader, try writing to a data set or the screen to verify that you are generating what you expect to generate
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Fri Feb 19, 2010 7:11 pm
Reply with quote

MBabu, a good idea.

But, could you please suggest how to modify this line to make REXX write to a dataset?
Code:
"ALLOC F(JCL) SYSOUT WRITER(INTRDR)"
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Fri Feb 19, 2010 9:30 pm
Reply with quote

Quote:
could you please suggest how to modify this line to make REXX write to a dataset?


Please see the help command for 'ALLOCATE' and see how to use the DATASET parameter.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Sat Feb 20, 2010 1:27 pm
Reply with quote

I was going to suggest
Code:
"ALLOC F(JCL) SYSOUT WRITER(INTRDR) RECFM(F B) LRECL(80)"
Back to top
View user's profile Send private message
santosh.ambaprasad

New User


Joined: 08 Mar 2009
Posts: 16
Location: London

PostPosted: Sat Feb 20, 2010 5:29 pm
Reply with quote

Hello there,

Referring to the message

Quote:
IEA995I SYMPTOM DUMP OUTPUT
SYSTEM COMPLETION CODE=013 REASON CODE=00000020
TIME=09.57.06 SEQ=12645 CPU=0000 ASID=003E
PSW AT TIME OF ERROR 075C1000 80E1005E ILC 2 INTC 0D
NO ACTIVE MODULE FOUND
NAME=UNKNOWN


I think, there is an issue allocating the DS in the JCL that is invoking this REXX.

Do you have SYSOUT allocated properly in your JCL?

Also, if you can write the output to a file and then copy it to INTRDR in next step, it provides better re-startability.

Am away from my VPN now.Once on it,I will try executing this program.
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Mon Feb 22, 2010 6:44 pm
Reply with quote

Pedro wrote:
Please see the help command for 'ALLOCATE' and see how to use the DATASET parameter.
Done. For future reference to others - ALLOCATE synthax is in the TSO/E Command Reference book.
After writing the output to a dataset, it seems the job has no errors.
Except one.. I overlooked it seems.. (see bellow)

expat wrote:
I was going to suggest
Code:
"ALLOC F(JCL) SYSOUT WRITER(INTRDR) RECFM(F B) LRECL(80)"
That helped. Thanks!!
Could You explain briefly why it doesn't work without RECFM and LRECL parameters?

@santosh.ambaprasad
Thanks for Your suggestion. It seems You were on the right track. Modification suggested by expat solved the problem.

Now... the thing I overlooked is that, I'm using DATE('S') function, which returns the date, in a 8 character format + an additional "D" (because dataset qualifier can't have all numerics) is 9 characters, which is invalid..
So I played with the date string a bit...
Here's my final working REXX.. Hope someone finds it useful in the future icon_smile.gif
Suggestions/improvements welcome, as always. icon_smile.gif

Code:
date = DELSTR(DATE('S'),1,2)                                         
year = DELSTR(date,3)                                                 
mnth = DELSTR(date,1,2)                                               
mnth = DELSTR(mnth,3)                                                 
day  = DELSTR(date,1,4)                                               
date = day !! mnth !! year                                           
queue "//MYJOB JOB (...,...,...,...),...,CLASS=X"       
queue "//STEP1  EXEC  PGM=ADRDSSU,REGION=2048K"                       
queue "//SYSPRINT DD  SYSOUT=*"                                       
queue "//OUTVOL1  DD  VOL=SER=VOL001,UNIT=SYSDA,DISP=SHR"             
queue "//SYSIN    DD  *"                                             
queue " COPY DATASET(INCLUDE(SOME.DATASET)) -"   
queue "      CANCELERROR -"                                           
queue "      OUTDDNAME(OUTVOL1) -"                                   
queue "      PERCENTUTILIZED(100) -"                                 
queue "      CATALOG -"                                               
queue "      RENAMEUNCONDITIONAL( -"                                 
queue "        (SOME.DATASET, -"                 
queue "         SOME.DATSET.D" !! date !! ")) -"
queue "      TGTALLOC(SOURCE) -"                                     
queue "      TOL(ENQF) -"                                             
queue "      FASTREP(PREF) -"                                         
queue "      WAIT(2,2)"                                               
queue "/*"                                                           
ADDRESS TSO                                                           
"ALLOC F(JCL) SYSOUT WRITER(INTRDR) RECFM(F B) LRECL(80)"             
"EXECIO" QUEUED() "DISKW JCL (FINIS"                                 
"FREE F(JCL)"
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Feb 22, 2010 7:20 pm
Reply with quote

Rather than faff about taking different bits from the current date why not use the code below.
This gives the date in YYMMDD format which keeps the datasets in chronological order when displayed via 3.4

Code:
DATEOUT = "D"||RIGHT(DATE('S'),6)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Mon Feb 22, 2010 7:21 pm
Reply with quote

a more elegant way of parsing the date would be ... to use the PARSE function

Code:
parse value(date("S")) with 3 yy 5 mm 7 dd
fdate = dd || mm || yy


another concern,
usually the file <timestamps> are <ordered> YYMMDD so that a 3.4 display
would more clear/useful

in that case a simple
Code:
fdate = substr(date("S"),3)

would give the desired token
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Wed Feb 24, 2010 7:01 pm
Reply with quote

Thanks for the suggestions guys, noted!

One other thing.. Does anyone know how could this be ran under System Automation?

When put in it's scheduler, the REXX doesn't function properly, and the NetView log outputs...

Code:
75 *-* "ALLOC F(JCL) SYSOUT WRITER(INTRDR) RECFM(F B)
   +++ RC(-3) +++                                   
76 *-* "EXECIO" QUEUED() "DISKW JCL (FINIS"         
   +++ RC(-3) +++                                   
77 *-* "FREE F(JCL)"                                 
   +++ RC(-3) +++


I guess running the REXX as a SysREXX is one solution, but is it a proper one in this case?
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Feb 25, 2010 5:05 am
Reply with quote

Those are TSO commands and they require a TSO environment. I doubt they will work from a system rexx environment either.

For ALLOCATE and FREE, try to use BPXWDYN to do similar functions. You might want to see the Netview manuals about how you can write to a file from Netview.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Feb 25, 2010 5:53 am
Reply with quote

You probably figured this out already, but its counter-productive to test in one environment and then try to execute in a different environment.
Back to top
View user's profile Send private message
Ivan P

New User


Joined: 08 Jun 2009
Posts: 63
Location: Europe

PostPosted: Thu Feb 25, 2010 1:21 pm
Reply with quote

Pedro wrote:
Those are TSO commands and they require a TSO environment. I doubt they will work from a system rexx environment either.
You're right, they don't work.

Pedro wrote:
You probably figured this out already, but its counter-productive to test in one environment and then try to execute in a different environment.
Indeed. I thought the transition would be easier or that Netview can use TSO environment somehow. Learning on my own mistakes.. icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Help with SORT - I need to validate d... DFSORT/ICETOOL 0
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
Search our Forums:

Back to Top