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
 

 

Chanfing strring using REXX pgm (TRIM issue)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 3:29 pm    Post subject: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

I want to include in a jcl a proc that search a specific string (double quote--> " ) in a dataset replacing by a new string (double double quote --> "") .This is what I need:

Let's suppose ...

input file
EDIT XDDB.CVDB.ARIBA.ARB Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data
000001 BCFAPPALACHIAN "ELECTRONICS"
000002 BCFAPPPALA "DWANE" ELECTRONICS

output file should be
EDIT XDDB.CVDB.ARIBA.SORTOUT1 Columns 00001 00072
000001 BCFAPPALACHIAN ""ELECTRONICS""
000002 BCF0APPALA ""DWANE"" ELECTRONICS

"Electronics" is not always in the same position. Depending the record of the file the double quote can be in moveable positions.

First attempt was include in a jcl the icemac proc with IFTHEN, OVERLAY. Since my system is using SYNCSORT failed..Dfsort has more advanced functions than syncsort. Like IFTHEN Supported by DFSORT, not by SYNCSORT.

Then, I decided to try coding a REXX pgm. Below you have code

[/code]
VIEW MS7901.REXX.EXEC(DOBLQUOT) - 01.11 Columns 00001 00072
Command ===> Scroll ===> CSR
000019 MEMBERN = '$DOC'
000020 J=0
000021 L=0
000022 COUNTERN=0
000023
000024 SAY 'MEMBER ' MEMBERN 'SELECTED'
000025
000026 DATASETIN = "'MS7901.REXX.TEST1.IN'"
000027 DATASETOT = "'MS7901.REXX.TEST1.OUT'"
000028
000029 DATAIN = DATASETIN
000030 DATAOT = DATASETOT
000031
000032 SAY 'COPY FROM' DATASETIN
000033 SAY 'TO ' DATASETOT
000034
000035 "ALLOC DA("DATAIN") F(INDD) SHR REUSE"
000036 "ALLOC DA("DATAOT") F(OUTDD) SHR REUSE"
000037 "EXECIO * DISKR INDD (STEM JCLLINE. FINIS"
000038 IF RC = 0
000039 THEN DO
000040
000041 DO J = 1 TO JCLLINE.0
000042 IF J = 1
000043 THEN DO
000044 SAY 'FIRST LINE'
000045 END
000046
000047 IF INDEX(JCLLINE.J,'"') \=0
000048 THEN DO
000049 K= INDEX(JCLLINE.J,'"')
000050 JCLLINE.J = SUBSTR(JCLLINE.J,1,(K-1))SUBSTR('""',1,2)
000051 SUBSTR(JCLLINE.J,(K+1),1500)
000052 L= L+1
000053 END
000054
000055 END
000056
000057
000058 SAY 'NUMBER LINES READED =' JCLLINE.0
000059 SAY 'NUMBER CHARS REPLACED =' L
000060 END
000061
000062 ELSE DO
000063 SAY 'ERROR IN EXECUTION ON FILE I/O'
000064 END
000065
000066
000067 QUEUE ''
000068
000069 "EXECIO" JCLLINE.0 "DISKW OUTDD (STEM JCLLINE. FINIS"
000070
000071 "FREE F(INDD OUTDD)"
000072
000073 IF RC = 0
000074 THEN DO
000075 SAY 'COPY FROM' DATAIN
000076 SAY 'TO ' DATAOT
000077 SAY ' '
000078 SAY ' COPY AND REPLACE COMPLETED RC ' RC
000079
000080 END
000081 ELSE DO
000082 SAY ' COPY AND REPLACE NOT COMPLETED RC ' RC
000083
000084 END
000085
000086
000087 SAY '_________________________________________________________'
000088 SAY ' '
000089 SAY ' REXX ENDED '
000090 SAY '_________________________________________________________'
000091
****** **************************** Bottom of Data ****************************

Below the results:

File Edit Edit_Settings Menu Utilities Compilers Test Help

VIEW MS7901.REXX.TEST1.IN Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ***********
000001 BCFTHERMO ELECTRON SCIENTIFIC" INSTRUMENTS
000002 BCFADVANCE "AMERICA" INC BOX #3406

File Edit Edit_Settings Menu Utilities Compilers Test Help
VIEW MS7901.REXX.TEST1.OUT Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data *****
000001 BCFTHERMO ELECTRON SCIENTIFIC""
000002 BCFADVANCE ""

As you can see rexx pgm is replacing " by "" but is trimming data behind.
Sample:
Input: HELLO "GOOD" MORNING
I want to read : HELLO ""GOOD" MORNING
I am getting: HELLO ""GOOD

I believe that I'll have to write a program that evaluates the data string and alters the " to "" as necessary.


Any idea?A quick response would be greatly appreciated.

Regards,
JORDI
Back to top
View user's profile Send private message

jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 3:37 pm    Post subject:
Reply with quote

background

http://ibmmainframes.com/forum/viewtopic.php?p=18435#18435
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 02, 2005 3:43 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Hi Jordi,

Should not it have been continued in the original topic itself....Why a new post ?
http://www.ibmmainframes.com/viewtopic.php?p=18200

Coming to the problem...Try this REXX.....

Code:
ADDRESS TSO                                         
'PROFILE NOPREFIX'                                 
SAY '-----------------------------------------'     
SAY '- BEGIN ---------------------------------'     
"EXECIO * DISKR FILELIST (STEM FILELIST. FINIS"     
DO ILIST = 1 TO FILELIST.0                         
I = 0                                               
TABTMP. = ''                                       
TABTMP.0 = 0                                       
FILELIST.ILIST = STRIP(FILELIST.ILIST,T)           
SAY ' FILE IN PROGRESS: ' FILELIST.ILIST           
"ALLOC DA('"FILELIST.ILIST"') F(FILEIN) SHR"       
"EXECIO * DISKR FILEIN(STEM TABTMP. FINIS"         
"FREE F(FILEIN)"                                   
"ALLOC DA('"FILELIST.ILIST"') F(FILEOUT) OLD"       
/* DEFINE STRING TO BE CHANGED */                   
CHANGED = 0                                         
PAR1 = '"'                                   
PAR2 = '""'                                   
CALL CHANGE                                                 
END                                                         
SAY '- END -----------------------------------'             
SAY '-----------------------------------------'             
EXIT RC                                                     
CHANGE:                                                     
DO I = 1 TO TABTMP.0                                         
IF INDEX(TABTMP.I,PAR1) > 0 THEN DO                         
CHANGED = CHANGED + 1                                       
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1)) 
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)       
END                                                         
END                                                         
RETURN


Job to run the REXX....

//STEP EXEC PGM=IKJEFT01,PARM='MEMBERNAME'
//SYSEXEC DD DISP=SHR,DSN=PDS.HAVING.MEMBER
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//FILELIST DD *
DATASET.YOU.WANT.TO.EDIT
//*


Try this code...& let us know......It was already provided in the link...I gave you in earlier same topic....

Regards,

Priyesh.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 02, 2005 4:10 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Sorry......Forgot to write outfile.....

This one should do much better.....

Code:
ADDRESS TSO                                       
'PROFILE NOPREFIX'                               
"EXECIO * DISKR FILELIST (STEM FILELIST. FINIS"   
DO ILIST = 1 TO FILELIST.0                       
I = 0                                             
TABTMP. = ''                                     
TABTMP.0 = 0                                     
FILELIST.ILIST = STRIP(FILELIST.ILIST,T)         
SAY ' FILE IN PROGRESS: ' FILELIST.ILIST         
"ALLOC DA("FILELIST.ILIST") F(FILEIN) SHR"       
"EXECIO * DISKR FILEIN(STEM TABTMP. FINIS"       
"FREE F(FILEIN)"                                 
"ALLOC DA("FILELIST.ILIST") F(FILEOUT) OLD"       
/* DEFINE STRING TO BE CHANGED */                 
CHANGED = 0                                       
PAR1 = 'test/itest'                               
PAR2 = 'dev/devl1'                               
CALL CHANGE                                                 
"EXECIO * DISKW FILEOUT(STEM TABTMP. FINIS"                 
"FREE F(FILEOUT)"                                           
END                                                               
EXIT RC                                                     
CHANGE:                                                     
DO I = 1 TO TABTMP.0                                       
IF INDEX(TABTMP.I,PAR1) > 0 THEN DO                         
CHANGED = CHANGED + 1                                       
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1))
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)       
END                                                         
END                                                         
RETURN 


Regards,

Priyesh.
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 4:20 pm    Post subject:
Reply with quote

Priesh,

My PDS having member is 'MS7901.REXX.EXEC(QUOTE)' which contains REXX code
and
dataset I want to edit
MS7901.REXX.TEST1.IN

Getting Error:
06:41:17 IAT4401 LOCATE FOR STEP=STEP DD=SYSEXEC DSN=MS7901.REXX.EXEC(QUOTE)
06:41:17 IAT4404 DATASET NOT FOUND ON MAIN PROCESSOR SY5
06:41:17 IAT4801 JOB MS7901AC (JOB18604) EXPRESS CANCELED BY INTERPRETER DSP

PARM='MEMBERNAME' should be informed?





Code:


EDIT       MS7901.CEDB.ARIBA.JCL(REXX2) - 01.02            Columns 00001 00072
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 //MS7901AC JOB (JW9740,JR), JORDI R,PROC(AST),34985124960,
000002 //             MSGCLASS=Q,CLASS=D,PRTY=5,MSGLEVEL=(1,1),NOTIFY=MS7901
000003 //*
000004 //*MAIN CLASS=DBD1
000005 //******************************************************************//
000006 //* EXEC BATCH REXX (WITHOUT TSO)                                  *//
000007 //******************************************************************//
000008 //STEP EXEC PGM=IKJEFT01,PARM='MEMBERNAME'
000009 //SYSEXEC DD DISP=SHR,DSN='MS7901.REXX.EXEC(QUOTE)'
000010 //SYSTSPRT DD SYSOUT=*
000011 //SYSTSIN DD DUMMY
000012 //FILELIST DD *
000013 MS7901.REXX.TEST1.IN
000014 //*
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 02, 2005 4:41 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Code:
000001 //MS7901AC JOB (JW9740,JR), JORDI R,PROC(AST),34985124960,
000002 //             MSGCLASS=Q,CLASS=D,PRTY=5,MSGLEVEL=(1,1),NOTIFY=MS7901
000003 //*
000004 //*MAIN CLASS=DBD1
000005 //******************************************************************//
000006 //* EXEC BATCH REXX (WITHOUT TSO)                                  *//
000007 //******************************************************************//
000008 //STEP EXEC PGM=IKJEFT01,PARM='QUOTE'
000009 //SYSEXEC DD DISP=SHR,DSN=MS7901.REXX.EXEC
000010 //SYSTSPRT DD SYSOUT=*
000011 //SYSTSIN DD DUMMY
000012 //FILELIST DD *
000013 MS7901.REXX.TEST1.IN
000014 //*



Try this...I corrected your code.....PARM was not specified properly...you missed to change that...

Regards,

Priyesh.
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 7:26 pm    Post subject:
Reply with quote

I m getting a MAXCC=0 for the Job, but not all double quote string are being changed in the Datsets how I want.

Before change
Code:

EDIT       MS7901.REXX.TEST1.IN                                 Data set saved
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 TEST "INSTRUMENT" PHONE "999999"  EMAIL
000002 ADVANCE "AMERICA" PHONE 3022324   TEST
000003 THERMAL TRANSFER  PHONE "30234"   TEST
000004 "CORPORATION" "TEST"
****** **************************** Bottom of Data ****************************

After change

VIEW       MS7901.REXX.TEST1.IN                            Columns 00001 00072
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 TEST ""INSTRUMENT" PHONE "999999"  EMAIL
000002 ADVANCE ""AMERICA" PHONE 3022324   TEST
000003 THERMAL TRANSFER  PHONE ""30234"   TEST
000004 ""CORPORATION" "TEST"
****** **************************** Bottom of Data ****************************



Note: Only changing first double quote string.
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 7:55 pm    Post subject:
Reply with quote

Any feedback?

Thanks,
JORDI
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 02, 2005 8:14 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Hi Jordi,

As I told you before...This code is provided by MGIndaco....

Quote:
If you find it thru your problem, dont forget to thank MGIndaco.....


& I m sure of his help again...

Regards,

Priyesh.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Sep 02, 2005 9:12 pm    Post subject:
Reply with quote

Hi to all.
Ok, insert this CHANGE to substitute the original and tell me if it work.
Code:
CHANGE:                                                   
DO I = 1 TO TABTMP.0                                       
Do while Index(Tabtmp.i,par1) > 0                /*modify*/
CHANGED = CHANGED + 1                                     
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1))
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)     
END                                                       
END                                                       
RETURN                                                     
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 02, 2005 9:32 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Hi MGIndaco,

Thats works perfact for me.... Thanks a lot.....

Now you will agree to the term absence count...Isn't it..... icon_biggrin.gif

Regards,

Priyesh.
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Fri Sep 02, 2005 9:33 pm    Post subject:
Reply with quote

It did not work.

Abend code

11:55:43 -JOBNAME STEPNAME PROCSTEP RC EXCP CONN TCB SRB CLOCK
11:55:43 -MS7901AC STEP *S322 21 13 1.01 .00 9.3
11:55:43 IEF404I MS7901AC - ENDED - TIME=11.55.43

it takes many many time and finally abended, It appears the jcl was in a loop

modification I did versus the original is insert this CHANGE to substitute the original

Code:

CHANGE:
DO I = 1 TO TABTMP.0
DO WHILE INDEX(TABTMP.I,PAR1) > 0                /*MODIFY*/
CHANGED = CHANGED + 1
STRAPP = DELSTR(TABTMP.I,INDEX(TABTMP.I,PAR1),LENGTH(PAR1))
TABTMP.I = INSERT(PAR2,STRAPP,INDEX(TABTMP.I,PAR1)-1)
END
END
RETURN
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Mon Sep 05, 2005 6:27 pm    Post subject:
Reply with quote

REXX pgm works perfect!!! Problem was that I could not change string doble quote '"' to doubly double quote '""' only in 1 step. I did it in 2 steps:

PAR1 = '"'
PAR2 = '&&'
CALL CHANGE
PAR1 = '&&'
PAR2 = '""'
CALL CHANGE

Thanks a lot.....specially to Priyesh and MGIndaco

Regards,
JORDI
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon Sep 05, 2005 6:37 pm    Post subject: Re: Chanfing strring using REXX pgm (TRIM issue)
Reply with quote

Hi Jordi,
Quote:
REXX pgm works perfect!!! Problem was that I could not change string doble quote '"' to doubly double quote '""' only in 1 step. I did it in 2 steps:

Now I got ....Something we missed earlier was very logical here....

After converting " to "" ...program again finds a new " ....& this process goes on....thats why your job earlier got time abend.
This was an intelligent move to change " to some other character & getting it back desirably.

Thank You... I learn something....

Regards,

Priyesh.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts Execessive parameter issue Sumeendar JCL & VSAM 5 Mon Dec 19, 2016 4:35 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm


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