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
 

 

How to get the full record length?

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

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Mon Feb 04, 2008 3:38 pm    Post subject: How to get the full record length?
Reply with quote

Hi all,

I have created a REXX tool which will remove the blank reords from a file. When I executed this code i got the output file without the blank records, but i have some concerns in the output file that i have got.

Concern1:

When i executed the code with a variable length input file (32760), i got the output file which is having 80 byte length only. What is the parameter to be added to create the output file as Variable length record?

Concern2:

I wanted to remove the blank records even it is present in between the good records i.e., the good records are not continuous, there may be blank records in between. The output file should contain only the good records and all the blank records should be removed.

When i tried with an input file having good record at first then 5 blank records and 1 good record again. My code took the first record alone and put it in the output file (that too only 80 bytes icon_sad.gif )
Please find the code for the same.

Code:

IF RC > 0 then EXIT
 ADDRESS "ISPEXEC"
 "ISPEXEC VGET (ZPFKEY) ASIS"
 IF ZPFKEY = 'PF03' THEN
   DO
       EXIT(0)
   END
HLQ = FILNM
PLQ = FILN
PLQ1 = STRIP(PLQ)
HLQ1 = STRIP(HLQ)
   ADDRESS "TSO"
   "ALLOC DSN('"PLQ1"') F(DD99) NEW SPACE (50 50) CYL"
ADDRESS "TSO"
 "FREE F(DD9)"
 "ALLOC DA('"HLQ1"') F(DD9) OLD"
 "NEWSTACK"
 ADDRESS "TSO"
 "EXECIO * DISKR DD9 (STEM LINE. FINIS"
 COUNT=LINE.0
   DO g=1 TO LINE.0
      IF LINE.g = "  " THEN
         LEAVE
      ELSE
       DO
         QUEUE LINE.G
       END
   END
 ADDRESS "TSO"
 "EXECIO * DISKW DD99 (STEM LINE. FINIS"
"EXECIO "QUEUED()" DISKW DD99 (FINIS"
  ADDRESS "TSO"
  "FREE F(DD99)"
 ADDRESS "TSO"
  "FREE F(DD9)"
  EXIT



Please suggest.

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

dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Feb 04, 2008 4:25 pm    Post subject:
Reply with quote

your allocate did not have a dcb entry for record length. If you input file is var length, you could use a model or like parm.

you will have to read up on excio to see if there is anything kinky about var len writes


something like this would be very easy in sort, but again, you need to watch out for you allocations and your write methodologies.
Back to top
View user's profile Send private message
Ashwin_mudikon

New User


Joined: 03 Apr 2007
Posts: 32
Location: Chennai

PostPosted: Mon Feb 04, 2008 5:18 pm    Post subject:
Reply with quote

Hi,

You can add LRECL(<maxlen>), RECFM(V) and BLKSIZE(<size>) parameters to the ALLOC command where you are creating the file.

Code:
"ALLOC DSN('"PLQ1"') F(DD99) NEW SPACE (50 50) CYL LRECL(32760) RECFM(V) BLKSIZE(32760)"
Back to top
View user's profile Send private message
Ashwin_mudikon

New User


Joined: 03 Apr 2007
Posts: 32
Location: Chennai

PostPosted: Mon Feb 04, 2008 5:23 pm    Post subject:
Reply with quote

Regarding your second concern, when you find a blank record, you have given LEAVE, which will terminate the loop. Instead give ITERATE, which will not terminate the loop but will continue with the next iteration.
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Mon Feb 04, 2008 6:34 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Thank you, Ashwin!!! It worked icon_biggrin.gif .

Cheers
Agni
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Mon Feb 04, 2008 6:51 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Ashwin,

I have one more doubt. In the code i have given the output file specifications as follows:

Code:

   "ALLOC DSN('"PLQ1"') F(DD99) NEW SPACE (50 50) CYL LRECL(32760), 
RECFM(V) BLKSIZE(32760)"                                           


This would allocate a file of space 50 cylinders in primary and secondary. But i want it to be allocated as per the input file attributes. Like for example, the input file which has lot of empty records may have been space allocated as per the good records and empty records. The space might be less than 5 cylinders. Why should we allocate 50 cylinders if that much space is not needed actually? I want the space to be allocated as per the input file as the space is varying according to the good records and empty reocrds.

I hope i have explained my requirement clearly.

Thanks in advance
Agni
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Tue Feb 05, 2008 2:33 pm    Post subject:
Reply with quote

Agni,

Instead of that alloc statement you can use this

"ALLOC DSN('<output dsn>') LIKE('<Input dsn>')"

This will allocate output dsn with same attributes as input dsn.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 05, 2008 3:10 pm    Post subject:
Reply with quote

you can also add the RLSE parm to the allocation.
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Wed Feb 06, 2008 9:21 am    Post subject:
Reply with quote

ADDRESS TSO
"ALLOC DSN('U153134.AAA') LIKE('U153134.CMP1')"
"ALLOC FI(DD9) DSN('U153134.CMP1') SHR REUSE"
"ALLOC FI(DD99) DSN('U153134.AAA') SHR REUSE"
"NEWSTACK"
"EXECIO * DISKR DD9 (STEM LINE. FINIS"
COUNT=LINE.0
DO G=1 TO LINE.0
IF LINE.G = " " THEN
ITERATE
ELSE
DO
QUEUE LINE.G
END
END
"EXECIO * DISKW DD99 (STEM LINE. FINIS"
"EXECIO "QUEUED( )" DISKW DD99 (FINIS"
"FREE F(DD99)"
"FREE F(DD9)"
EXIT


I have a concern on this code
I wanted to remove the blank records that are present between the good records i.e., the good records are not continuous, there may be blank records in between. The output file should contain only the good records and all the blank records should be removed.

When i tried with an input file having good record at first then 3 blank records and 1 good record again. My code took the both the good and blank records as it is.

Thanks in Advance
Kavya
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Feb 06, 2008 11:54 am    Post subject:
Reply with quote

Have you considered using SORT to remove blank records?

O.
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Feb 06, 2008 12:01 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Hi Kavya,

When i tried to use the LIKE parameter as follows.

Code:

   "ALLOC DSN('"PLQ1"') F(DD99) LIKE DA('"HLQ1"') F(DD9)"


I got the following message.

Code:

MISSING MODEL DATASET NAME+                                 
MISSING NAME OF DATASET WHOSE ATTRIBUTES ARE TO BE COPIED   
FILE DD9 NOT FREED, IS NOT ALLOCATED                         
FILE DD99 NOT FREED, IS NOT ALLOCATED                       
***                                                         


Please suggest.

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

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Feb 06, 2008 12:14 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Hi Ofer71,

I know this can be done by using SORT, but i wanted to learn REXX. I created this tool some 2 or 3 months back. Now i am fine tuning this code.

Thanks
Agni.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Feb 06, 2008 1:03 pm    Post subject:
Reply with quote

The first step in fine-tuning is to use the correct tools for your mission.

REXX is a great programming language, and it is my favorite one for system programming. However, I am aware of its (few) limitation, mainly when it regards to performance.

I had a case in the past, where an ISPF tables got so big, that the REXX processing took about 5 minute to match records from 3 tables. I replaced the match logic with internal calls to ICETOOL, and it reduced the processing time to 20 seconds.

Remember - Use the correct tool for each mission.

O.
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Feb 06, 2008 1:30 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Thanks Ofer71 for your suggestion. It will be of great help if you give some inputs to my query.

I will try do this in SORT also after i complete this one in REXX.

Cheers
Agni.
Back to top
View user's profile Send private message
kavya123
Warnings : 1

New User


Joined: 11 Jul 2007
Posts: 34
Location: hyderabad

PostPosted: Wed Feb 06, 2008 3:45 pm    Post subject:
Reply with quote

Agni,

By this way you can use like parm

ADDRESS TSO
HLQ1= Myid.FILNM
PLQ1= Myid.FILN

"ALLOC DSN('"PLQ1"') LIKE ('"HLQ1"')"
"ALLOC FI(DD9) DSN('"HLQ1"') SHR REUSE"
"ALLOC FI(DD99) DSN('"PLQ1"') SHR REUSE"

This is working fine.
I checked it.

Regards,
Kavya.
Back to top
View user's profile Send private message
Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Wed Feb 06, 2008 7:50 pm    Post subject: Reply to: How to get the full record length?
Reply with quote

Yep. It worked fine icon_biggrin.gif . Thank u very much.

Cheers
Agni
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 update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


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