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
 

 

Read record and Strip data from column 45-55 in other datase

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

New User


Joined: 18 May 2009
Posts: 16
Location: Hyd

PostPosted: Sat Nov 14, 2009 9:41 pm    Post subject: Read record and Strip data from column 45-55 in other datase
Reply with quote

Hi ,

I do this work manually
1) browse dataset do F '2A' 20 21 ALL to get count of number of account
2) Do F '2A' 20 21 and copy data in Column 45 to 55 from that particular record in other dataset ..

Please how this can be automated using rexx ..
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Nov 14, 2009 10:17 pm    Post subject:
Reply with quote

read the file,
if the record contains '2A' in 20 & 21,
then parse the record collecting columns 45 to 55
and output that data to your new file.

How many records are in the dataset, on average?
what is the record length of the input file?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Nov 15, 2009 2:14 am    Post subject:
Reply with quote

Sorry,
read the file
Commands neccessary: Allocate, EXECIO

Process input
DO a=1 TO input-record.0 by 1

if record contains '2A' in 20 & 21,
IF SUBSTR(input-record.a,20,2) = "2A" THEN

then parse the record collecting columns 45 to 55
Commands: PARSE or SUBSTR

and output that data to your new file.
Commands neccessary: Allocate, EXECIO

FREE both files.

REXX Reference
REXX User Guide
Back to top
View user's profile Send private message
Phalgun

New User


Joined: 18 May 2009
Posts: 16
Location: Hyd

PostPosted: Mon Nov 16, 2009 8:26 am    Post subject: Reply to: Read record and Strip data from column 45-55 in ot
Reply with quote

Hi Dz Thanks for your reply ..

My Output should also includue total number of unique record that qualify.. I usually find that giving command F '2A' 20 21 ALL .. How to decipher this part of code in rexx ..
Second question how to "parse the record collecting columns 45 to 55 "

I'm new to rexx languagE

:cry:
I tried to write this part of code as per your suggestion .. But still it is incomplete

/* Rexx */

"ALLOC DA('My.input') F(indd) SHR REUSE"
"ALLOC DA('my.output') F(Outdd) New"
"EXECIO * DISKR indd (STEM newip."
/* Return count of number of records in dataset */
"ISREDIT FIND ALL '2A' 20 21 "
"ISREDIT (COUNT) = FIND_COUNTS"
SAY Total number of records "=" count
DO i=1 TO newip.0 BY 1
IF SUBSTR(newip.i,20,2) = '2A' THEN
/*PAse record from Column 45 55 into array*/
/* Write it to new file */
FREE F (Indd outdd)

dz i tried but not able to complete and retest as it is incomplete.. Please help me to correct this code ..

Say input file contain 6 records
after this code run
out put :
Total number of records = 6
Accounts number qualify
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx

where xxxxxxxxx --> account info in col 45 -55 ..

Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Nov 16, 2009 3:10 pm    Post subject:
Reply with quote

Quote:

/* Rexx */

"ALLOC DA('My.input') F(indd) SHR REUSE"
"ALLOC DA('my.output') F(Outdd) New"
"EXECIO * DISKR indd (STEM newip."
/* Return count of number of records in dataset */
"ISREDIT FIND ALL '2A' 20 21 "
"ISREDIT (COUNT) = FIND_COUNTS"
SAY Total number of records "=" count
DO i=1 TO newip.0 BY 1
IF SUBSTR(newip.i,20,2) = '2A' THEN
/*PAse record from Column 45 55 into array*/
/* Write it to new file */
FREE F (Indd outdd)

ABSOLUTLY UNTESTED

Code:


/* Rexx */

"ALLOC DA('My.input') F(indd) SHR REUSE"
"ALLOC DA('my.output') F(Outdd) New"

"EXECIO * DISKR indd (STEM newip."
/* Return count of number of records in dataset */
num_hits = 0
newop=""
DO i=1 TO newip.0 BY 1
 IF SUBSTR(newip.i,20,2) = '2A' THEN
   DO
     num_hits = num_hits + 1
     newop.num_hits = SUBSTR(newip.i,45,11)
   END
END
newop.0 = num_hits
"EXECIO * DISKW Outdd (STEM newop"
FREE F (Indd outdd)


your EXECIO read should have fini, probably the write also.
others I am sure will add to the post.
did not feel like generating a PARSE statement for you,
but if you look in the manual, PARSE with pattern, especially when you know the physical location is easy.
I think the PARSE will be more effecient than the SUBSTR, but both will work.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Nov 16, 2009 3:12 pm    Post subject:
Reply with quote

your REXX script is a not a MACRO,

so, your FIND commands are useless.

by the way,
excellent first attempt!
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 how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am


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