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: 1458
Location: Azeroth

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: 7251

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: 7251

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: 2180
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
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


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