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
 

 

My OUTPUT file should be in this way

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
anish.ibm

New User


Joined: 28 Jun 2007
Posts: 23
Location: Bangalore

PostPosted: Tue Jul 24, 2007 8:06 am    Post subject: My OUTPUT file should be in this way
Reply with quote

Hi All,

I have a below requirement , Need your help on the below.

My input file has records like this.

Code:

   ABC-2
MAIN 1
   ABC-1
MAIN 2
   ABC-3
   ABC-6
MAIN 3


My OUTPUT file should be in this way

Code:

          ABC-2 MAIN 1
          ABC-1 MAIN 2
          ABC-3 000000
          ABC-6 MAIN 3


Here.. the OUTPUT file was formatted in such way that ..MAIN is being clubbed with ABC .. if MAIN
is found immediately after the ABC . IF MAIN was not there immediately after any ABC .. that particular ABC should be clubbed with zeroes or can be left blanks

Thq
[/quote]
Back to top
View user's profile Send private message

ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Jul 24, 2007 2:48 pm    Post subject:
Reply with quote

Hi anish.ibm,
You haven't give LRECL of file, length of key, but still I have tried to provide you the soln with ceratin assumptions.
Here is your SORT JCL
Code:

//S1      EXEC PGM=ICETOOL                       
//TOOLMSG DD SYSOUT=*                           
//DFSMSG  DD SYSOUT=*                           
//*                                             
//IN1     DD *                                   
ABC-2                                           
MAIN1                                           
ABC-1                                           
MAIN2                                           
ABC-3                                           
ABC-6                                           
MAIN3                                           
/*                                               
//*                                             
//OUT1    DD SYSOUT=*                                                   
//TEMP    DD DSN=&&TEMP,SPACE=(CYL,(1,1),RLSE),DISP=(MOD,KEEP,DELETE)   
//TEMP1   DD DSN=&&TEMP1,SPACE=(CYL,(1,1),RLSE),DISP=(MOD,KEEP,DELETE) 
//TOOLIN  DD *                                                         
    COPY FROM(IN1) TO(TEMP) USING(SRT1)                                 
    SPLICE FROM(TEMP) TO(TEMP1) ON(1,10,ZD) -                           
      WITH(16,5) KEEPNODUPS                                             
    COPY FROM(TEMP1) TO(OUT1) USING(SRT2)                               
/*                                                                     
//SRT1CNTL DD *                                                     
    OPTION COPY                                                     
    OUTREC IFTHEN=(WHEN=INIT,                                       
           BUILD=(SEQNUM,10,ZD,11:1,5)),                           
           IFTHEN=(WHEN=(11,4,CH,EQ,C'MAIN'),                       
           BUILD=((1,10,ZD,SUB,+1),EDIT=(TTTTTTTTTT),5X,11,5))     
/*                                                                 
//*                                                                 
//SRT2CNTL DD *                                                     
    OPTION COPY                                                     
    OUTREC IFTHEN=(WHEN=(16,4,CH,EQ,C'MAIN'),                       
                   BUILD=(11,10)),                                 
           IFTHEN=(WHEN=NONE,                                       
                   BUILD=(11,5,C'00000'))                           
/*                                                                 


Output

Code:

ABC-2MAIN1   
ABC-1MAIN2   
ABC-300000   
ABC-6MAIN3   


--Parag
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jul 24, 2007 11:09 pm    Post subject:
Reply with quote

anish,

Here's a more efficient way to do what you asked for. It only takes one SORT pass (for SPLICE) as opposed to Parag's way which takes one SORT pass (for SPLICE) and two COPY passes. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Alternatively, without the April, 2006 PTF, you could do it in a COPY pass and one SORT pass (for SPLICE).

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN  DD *
   ABC-2
MAIN 1
   ABC-1
MAIN 2
   ABC-3
   ABC-6
MAIN 3
/*
//OUT DD SYSOUT=*
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) KEEPNODUPS -
  WITH(17,6) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,1,CH,EQ,C' '),
          BUILD=(11:4,5,17:C'000000',81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
          OVERLAY=(17:1,6,
            89:SEQNUM,8,ZD,
            81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,BUILD=(1,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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm


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