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
 

 

REXX for backing up datasets with a date
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: REXX for backing up datasets with a date
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: 2150
Location: At my coffee table

PostPosted: Fri Feb 19, 2010 2:20 pm    Post subject: Re: REXX for backing up datasets with a date
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: 1703
Location: Australia

PostPosted: Fri Feb 19, 2010 2:22 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Fri Feb 19, 2010 2:25 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 19, 2010 2:50 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 19, 2010 3:06 pm    Post subject:
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

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Fri Feb 19, 2010 4:54 pm    Post subject:
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: 401
Location: Mumbai

PostPosted: Fri Feb 19, 2010 6:33 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Feb 19, 2010 9:30 pm    Post subject: Reply to: REXX for backing up datasets with a date
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: 8593
Location: Back in jolly old England

PostPosted: Sat Feb 20, 2010 1:27 pm    Post subject:
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Mon Feb 22, 2010 7:20 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Feb 22, 2010 7:21 pm    Post subject: Reply to: REXX for backing up datasets with a date
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    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 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
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


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