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
 

 

help needed in writing header for records

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

New User


Joined: 07 Sep 2006
Posts: 6
Location: chennai

PostPosted: Thu Jan 07, 2010 4:34 pm    Post subject: help needed in writing header for records
Reply with quote

Hi,

I am reading each record and writing to file by using DO.. END loop. Records are written in output record succesfully. next thing is concerned about ADDING HEADER to the written records. How can i do that in the program

Thank you
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: Thu Jan 07, 2010 5:08 pm    Post subject:
Reply with quote

Please explain exactly what you want to do.

You read the records, and by definition, a header record should be the first redord in the file.

Is it a standard header or does its contents depend on the file data.

Unless you start to give some detail about what you want / need to do, you will not receive any great help if any at all.
Back to top
View user's profile Send private message
tilak_arani

New User


Joined: 07 Sep 2006
Posts: 6
Location: chennai

PostPosted: Thu Jan 07, 2010 5:56 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

i just need a standard header expat...

tried giving push but didnt worked out

the code :
Code:

/*********REXX*********/                                       
"EXECIO * DISKR INDD (STEM INPUT. FINIS"             
SAY 'INDD FILE IS OPEN....'                         
PUSH  'EMPNO  DEPTNO NAME'                           
"EXECIO 1 DISKW OUTDD "                               
COUNT = 1                                           
DO WHILE COUNT <= INPUT.0                           
  LINE1 = INPUT.COUNT                                 
  PARSE VAR LINE1 1 EMPNO 7  7 DEPTNO 10 10 NAME       
  OUTLINE.COUNT = EMPNO  DEPTNO NAME                   
  "EXECIO * DISKW OUTDD (STEM OUTLINE. FINIS"         
  IF RC = 0 THEN                                       
  SAY 'ALL RECS ARE WRITTEN IN PS'                     
  ELSE SAY 'NOT COMPLETED...'                         
  COUNT = COUNT + 1                                   
END   
EXIT
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jan 07, 2010 7:05 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

Don't do this, since you are essentially overwriting your previous write:

"EXECIO * DISKW OUTDD (STEM OUTLINE. FINIS"

Queue the output records instead:

Code:

/*********REXX*********/           
...                             
"EXECIO * DISKR INDD (STEM INPUT. FINIS"             
SAY 'INDD FILE IS OPEN....'                         
QUEUE  'EMPNO  DEPTNO NAME'
DO COUNT = 1 TO INPUT.0                                                           
  PARSE VAR INPUT.COUNT 1 EMPNO 7  7 DEPTNO 10 10 NAME       
  QUEUE EMPNO  DEPTNO NAME                                       
END   
"EXECIO "QUEUED()" DISKW OUTDD (FINIS" 
EXIT


If you really MUST use the stem variables, i.e.:

"EXECIO * DISKW OUTDD (STEM OUTLINE. FINIS"

then you should've made the first stem OUTLINE.1 your header:

Code:

/*********REXX*********/                                       
"EXECIO * DISKR INDD (STEM INPUT. FINIS"             
SAY 'INDD FILE IS OPEN....'                         
OUTLINE.1 =  'EMPNO  DEPTNO NAME'                             
COUNT = 1                                           
DO WHILE COUNT <= INPUT.0                           
  LINE1 = INPUT.COUNT                                 
  PARSE VAR LINE1 1 EMPNO 7  7 DEPTNO 10 10 NAME
  INDEX = COUNT + 1       
  OUTLINE.INDEX = EMPNO  DEPTNO NAME     
  COUNT = COUNT + 1   
END             
"EXECIO * DISKW OUTDD (STEM OUTLINE. FINIS"         
IF RC = 0 THEN                                       
  SAY 'ALL RECS ARE WRITTEN IN PS'                     
  ELSE SAY 'NOT COMPLETED...'                                                             
EXIT
Back to top
View user's profile Send private message
tilak_arani

New User


Joined: 07 Sep 2006
Posts: 6
Location: chennai

PostPosted: Thu Jan 07, 2010 7:22 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

thank you SuperK.... icon_smile.gif
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jan 07, 2010 7:28 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

Also ...

Code:

DO WHILE COUNT <= INPUT.0                           
  LINE1 = INPUT.COUNT                                 
  PARSE VAR LINE1 1 EMPNO 7  7 DEPTNO 10 10 NAME       
  OUTLINE.COUNT = EMPNO  DEPTNO NAME                   
  "EXECIO * DISKW OUTDD (STEM OUTLINE. FINIS" <===
  IF RC = 0 THEN                                       
  SAY 'ALL RECS ARE WRITTEN IN PS'                     
  ELSE SAY 'NOT COMPLETED...'                         
  COUNT = COUNT + 1                                   
END


why did you want to completely write every stem variable (OUTLINE.) each time you made an iteration through the loop?
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu Jan 07, 2010 10:14 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

Quote:
next thing is concerned about ADDING HEADER to the written records. How can i do that in the program


Not sure if your question was answered. In any case, it was not stated clearly enough so I know what you are asking.
Back to top
View user's profile Send private message
tilak_arani

New User


Joined: 07 Sep 2006
Posts: 6
Location: chennai

PostPosted: Fri Jan 08, 2010 6:51 pm    Post subject: help needed in writing header for records
Reply with quote

superk,

actually i was just started working on rexx. so i iterated as we do in cobol.
your reply with code is very clear. thank you very much

Pedro,

thanks for the concern
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jan 08, 2010 7:42 pm    Post subject: Reply to: help needed in writing header for records
Reply with quote

This is a tip. I don't know how REXX is being taught, but I think that beginners needs to stay away from the stem variables until they have a better grasp of how to properly use the data stacks. I realize that what you did is just an exercise, since there are obviously better ways to accomplish what you wanted. However, honestly, I'd write my own code like this, especially if I don't know the amount of the potential input data:

Code:

/* REXX */
FIRST = 1                                         
DO FOREVER                                       
  "EXECIO 1 DISKR INDD"                           
  IF RC <> 0 THEN LEAVE                           
  PARSE PULL RECORD                               
  IF FIRST THEN                                   
    DO                                           
      PUSH 'EMPNO DEPTNO NAME'                   
      "EXECIO 1 DISKW OUTDD"                     
      FIRST = 0                                   
    END                                           
  PARSE VAR RECORD 1 EMPNO 7 DEPTNO 10 NAME       
  PUSH EMPNO DEPTNO NAME                         
  "EXECIO 1 DISKW OUTDD"                         
END                                               
"EXECIO 0 DISKR INDD (FINIS"                     
"EXECIO 0 DISKW OUTDD (FINIS"                     
EXIT 0                                           
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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