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
 

 

To write header based on condition

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

New User


Joined: 24 Jul 2006
Posts: 35
Location: india

PostPosted: Tue Jan 03, 2012 3:59 pm    Post subject: To write header based on condition
Reply with quote

Hi,

In a Jcl I need to write a header when ever space comes in the input record.Could anyone help me in writing header based on this condition?
Back to top
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1491
Location: Chennai

PostPosted: Tue Jan 03, 2012 4:04 pm    Post subject:
Reply with quote

Hi,
Show us a sample of input and the output records & the rules, someone might be able to help.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Jan 03, 2012 4:06 pm    Post subject: Reply to: To write header based on condition
Reply with quote

To add to Vasanthz's request, tell us what program you'd like the JCL to use to do this, please.
Back to top
View user's profile Send private message
Soumik Das

New User


Joined: 06 Aug 2011
Posts: 25
Location: India

PostPosted: Tue Jan 03, 2012 4:07 pm    Post subject: Reply to: To write header based on condition
Reply with quote

Quote:
when ever space comes in the input record


What do you exactly mean by that?

Some examples might help us understand your requirement better.
Back to top
View user's profile Send private message
jemonthomas

New User


Joined: 24 Jul 2006
Posts: 35
Location: india

PostPosted: Tue Jan 03, 2012 4:16 pm    Post subject:
Reply with quote

For Example Input file looks as below

ABCD Thomas
ABCD James
ABCD Tom

BCDE Charlie
BCDE Mahesh
BCDE Sunil

CDEF Sachin
CDEF Arun

Output file should looks like
Sl No: Name
ABCD Thomas
ABCD James
ABCD Tom

Sl No: Name
BCDE Charlie
BCDE Mahesh
BCDE Sunil

Sl No: Name
CDEF Sachin
CDEF Arun
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Jan 03, 2012 6:41 pm    Post subject: Reply to: To write header based on condition
Reply with quote

If you want to use Sort:

Put in an IF in an Outrec which identifies a blank record, use the Slash operator (if Syncsort has that or an equivalent), outputting your blank first and then generating the header.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Wed Jan 04, 2012 12:09 am    Post subject: Reply to: To write header based on condition
Reply with quote

Here is the code...



Code:

//S1A  EXEC PGM=SORT                               
//$ORTPARM  DD DSN=IMS.PARMLIB(IMSMS005),DISP=SHR 
//SORTIN    DD *                                   
ABC THOMAS                                         
ABC RICHARD                                       
ABC MATHEW                                         
ABC TOM                                           
                                                   
BCD NEENA                                         
BCD NAMITHA                                       
BCD NISHA                                         
                                                   
CDE ARUN                                           
CDE NIRMAL                                         
//SORTOUT   DD SYSOUT=*                           
//SYSOUT    DD SYSOUT=*                           
//SYSPRINT  DD SYSOUT=*                                               
//SYSIN     DD *                                                       
 INREC IFTHEN=(WHEN=(1,3,CH,NE,C' '),BUILD=(1,3,X,5,10,X,16:SEQNUM,   
                      8,ZD,RESTART=(1,3))),                           
      IFTHEN=(WHEN=(1,3,CH,EQ,C' '),BUILD=(1,3,X,5,10))               
 SORT FIELDS=COPY                                                     
 OUTFIL IFOUTLEN=80,                                                   
 IFTHEN=(WHEN=(16,8,ZD,GT,1),BUILD=(1,03,4X,5,10,61X)),               
 IFTHEN=(WHEN=(16,8,ZD,EQ,1),BUILD=(C'SL NO: NAME',/,1,03,4X,5,10,61X))




Your output:-
Code:

SL NO: NAME           
ABC    THOMAS         
ABC    RICHARD       
ABC    MATHEW         
ABC    TOM           
                     
SL NO: NAME           
BCD    NEENA         
BCD    NAMITHA       
BCD    NISHA         
                     
SL NO: NAME           
CDE    ARUN           
CDE    NIRMAL


Thanks
-3nadh
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Jan 04, 2012 4:49 pm    Post subject:
Reply with quote

Or even this.
Code:
//SYSIN     DD *                                           
 OPTION COPY                                               
 OUTREC OVERLAY=(81:SEQNUM,8,ZD)                           
 OUTFIL IFTHEN=(WHEN=(01,1,CH,EQ,C' '),                   
                BUILD=(1,80,/,C'SL NO: NAME')),           
        IFTHEN=(WHEN=(81,8,ZD,EQ,1),                       
                BUILD=(C'SL NO: NAME',/,1,80)),IFOUTLEN=80
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. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am


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