Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to create and write to an output File

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

New User


Joined: 29 Jun 2007
Posts: 2
Location: Singapore

PostPosted: Mon Jul 23, 2007 9:01 am    Post subject: How to create and write to an output File
Reply with quote

Hi All,

I am trying to generate a listing of data sets which are taking more than
150 Tracks and write them to an output file.

In order to do this, I used LISTDSI to get the details of files but I
don't know how to write them into an output file:

Here is what I have coded so far:

Code:

/* REXX */                                                   
"DELETE OUTPUT.FILE"                                 
"ALLOC DA(OUTPUT.FILE) NEW REU RECFM(F,B) LRECL(80)",
"DIR(255) SPACE(10,10) TRACKS UNIT(SYSDA)"                   
                                                             
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(FILES.*)"           
  DO FOREVER                                                 
    "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST)" ,           
                    "DATASET(DSNVAR) STATS(YES)"             
     IF RC = 0 THEN CALL WRITE_OUTFILE                       
     ELSE LEAVE                                             
  END                                                       
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"                 
                                                             
EXIT   
                                                             

/*-- WRITE TO AN OUTPUT --*/             
 WRITE_OUTFILE :                     
   X = LISTDSI(DSNVAR)               
   OUTREC = DSNVAR ' ; ' SYSALLOC ';' SYSBLKSTRK             
 /* i want to write outrec to allocated file "OUTPUT.FILE"  */
                                     
 RETURN   

So in a nutshell here are my problems:
1. How do I write the details (e.g. SYSALLOC, SYSBLKSTRK) into the output file I have newly allocated. Sample Coded is greatly appreciated.

2. Is there a way to sort this listing according to SYSALLOC?


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

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Jul 23, 2007 10:40 am    Post subject:
Reply with quote

First, assign a FILE name to your allocated file. Then use EXECIO with DISKW to write into that file.

If it was my mission, I would probably fill an array with the data, then sort it using a simple bubble sort algorithm, then write the whole array into the file.

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

New User


Joined: 29 Jun 2007
Posts: 2
Location: Singapore

PostPosted: Fri Jul 27, 2007 6:24 am    Post subject:
Reply with quote

Hi ofer71,

Thanks for your tips. How do you code a bubble sort algorithm?
Can you provide a sample code to make it easier for me to
understand?

Thanks in advance.
Roni
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 27, 2007 6:58 am    Post subject:
Reply with quote

Hello and welcome to the forums,

See if this will help - i snagged it from the web and have not actually loaded it onto a system and tried it.

Code:
/*rexx program bubbsort - illustrates a bubble sort */

/* load the array
   may also be loaded by execio, or a call outtrap
*/
name.1 = "marie"
name.2 = "beth"
name.3 = "linda"
name.4 = "maria"
name.5 = "nadia"
name.6 = "angela"
name.7 = "michelle"
count_of_elements = 7

/* loop through the array (count_of_elements - 1) ** 2 times */
do i = 1 to  (count_of_elements - 1)
   do j = 1 to (count_of_elements - 1)
      j_plus1 = j + 1
      /* if an element is greater than the next one higher,
         interchange them */
      if name.j > name.j_plus1 then call flipem
   end j
end i

/* show results*/
do i = 1 to count_of_elements
   say name.i
end i

exit

flipem:
/* reverse the order of the two elements */
temp = name.j
name.j = name.j_plus1
name.j_plus1 = temp
return

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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am
No new posts Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us