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
 
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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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