IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need the above report file will come in to the below format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue May 08, 2007 2:39 pm
Reply with quote

Hi Friends,

i have one report file like:
Code:

rec1  :1234
rec2  :abc

rec3
rec4
rec5
record 6
record 7


i need the above report file will come in to the below format:
Code:


1234 abc rec3
1234 abc rec4
1234 abc rec5
record 6
record 7



-GNATH
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Tue May 08, 2007 3:12 pm
Reply with quote

Your requirement is not clear..... What is that you want..u want to insert the value of rec 1 and 2 for the first 3 records or u want to fill the values where u find "rec" and not "record".

Regards,
Syam
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue May 08, 2007 3:43 pm
Reply with quote

Hi syam,

Below i am given my actual requirement. please look at below.

INPUT FILE.

Code:


MONTH   : 200704      * This is first rec in input file
CODE     : AAA          *  Second record

232LD2  23  3434.34  * 3rd record
34433D  32  3533.32  * 4th record
645DSF  44  5434.43  * 5th record
TOTAL:34323.34        * 6th record.



I want the OUTPUT file using JCL like.

Code:


200704 AAA  232LD2  23  3434.34    *This is the 1st record in Output file.
200704 AAA  34433D  32  3533.32    *2nd Record.
200704 AAA  645DSF  44  5434.43    *3rd record.
TOTAL:34323.34                              *4th record.



So i want the MONTH and CODE data in input file will come together with the 3rd,4th and 5th rec (means for every record) in output file.

please help me.

-GNATH
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue May 08, 2007 3:57 pm
Reply with quote

and... why don't you just change the program that is generating the report?
icon_question.gif
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue May 08, 2007 4:41 pm
Reply with quote

Hi,

As per requirement they dont want distrub the program. so thats y i want it thru JCL.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue May 08, 2007 9:22 pm
Reply with quote

Gnath,

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=55, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/55)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
  OPTION COPY,STOPAFT=2
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=(1,5,CH,EQ,C'MONTH'),
     BUILD=(C'MyMonth,''',11,7,C'''')),
   IFTHEN=(WHEN=(1,4,CH,EQ,C'CODE'),
     BUILD=(C'MyCode,''',11,5,C''''))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file (FB/55)
//SORTOUT DD DSN=...  output file (FB/67)
  OPTION COPY,SKIPREC=2
  INREC IFTHEN=(WHEN=(1,5,CH,NE,C'TOTAL'),
     BUILD=(MyMonth,MyCode,1,55))
/*
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Wed May 09, 2007 11:10 am
Reply with quote

Hi Frank Yaeger,

Thx for Your Reply on this. Can you please explain how the 'BUILD=(C'MyMonth,''',11,7,C'''')), ' statement is work in the above job. i didn't heard this statement. and can you please tell me, why you take the string 'MyMonth' and 'MyCode' and what is it significant.

Please, Briefly explain the above job how it will work.

Thx and Regards
GNATH.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Wed May 09, 2007 11:22 am
Reply with quote

Hi Frank,

As per my understanding the above job will work.

First it will copy the first two records and it will stop after 2 records and then it will check according to IF statement. but here i didn't understand the statement "INREC IFOUTLEN=80,'. and then it will create two variables like 'My Month' and 'My Code'. so we get the values from input file in to this variables using BUILD statement.

and next step, we copy the input file by skiping the first two records including with 'My Month' and My Code' and remaining 1 to 55 bytes.

is my understanding is rt?

-GNATH
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Wed May 09, 2007 7:19 pm
Reply with quote

Hi Frank,

I am trying with using your program, but i got the error like:

Code:


             IFTHEN=(WHEN=(3,5,CH,NE,C'TOTAL'),                   
                BUILD=(MYMONTH,MYCODE,1,133))                     
                       $                                       
ICE007A 1 SYNTAX ERROR                                           
ICE052I 3 END OF DFSORT                                           


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

DFSORT Developer


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

PostPosted: Wed May 09, 2007 9:27 pm
Reply with quote

Quote:
is my understanding is rt?


Yes.

Quote:
i didn't understand the statement "INREC IFOUTLEN=80,'


IFOUTLEN=80 just ensures that the resulting record length is 80 which is required for the SYMNAMES data set.

Quote:
but i got the error like


The job I posted works as shown. You must have changed something. I can't tell what you changed from what you posted (other than that you changed Mymonth to MYMONTH). Please post all of your JCL so I can see what you did.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Thu May 10, 2007 10:20 am
Reply with quote

Hi Frank,

below i am given my actual requirement.

Code:


MONTH   : 200704      * This is first rec in input file
CODE     : AAA          *  Second record

232LD2  23  3434.34  * 3rd record
34433D  32  3533.32  * 4th record
645DSF  44  5434.43  * 5th record
TOTAL:34323.34        * 6th record.

MONTH   : 200705      * This is 7th rec in input file
CODE     : BBB          *  8th record

232DS2  23  3444.34  * 9rd record
3FS433  32  4533.32   * 10th record
645DSF  44  5484.43  * 11th record
TOTAL:3432323.34     * 12th record.

MONTH   : 200705      * This is 13th rec in input file
CODE     : CCC         *  14th record

23DSS2   23  6446.34  * 15rd record
3FSHH33  32  2533.32  * 16th record
645DS43  44  5984.53  * 17th record
TOTAL:345423.34        * 18th record.



For this i want the below format.

Code:


200704 AAA 232LD2  23  3434.34  * 1rd record
200704 AAA 34433D  32  3533.32  * 2th record
200704 AAA 645DSF  44  5434.43  * 3th record
TOTAL:34323.34        * 4th record
200705 BBB 232DS2  23  3444.34  * 5rd record
200705 BBB 3FS433  32  4533.32   * 6th record
200705 BBB 645DSF  44  5484.43  * 7th record
TOTAL:3432323.34     * 8th record.
200705 CCC 23DSS2   23  6446.34  * 9th record
200705 CCC 3FSHH33  32  2533.32  * 10th record
200705 CCC 645DS43  44  5984.53  * 11th record
TOTAL:345423.34        * 12th record.



For getting above format i am using urs job and i changed in the job. below i am given the job details. But i got an error as above like


IFTHEN=(WHEN=(1,5,CH,NE,C'TOTAL'),
BUILD=(MNTH,CODE,1,133))
$
ICE007A 1 SYNTAX ERROR
ICE052I 3 END OF DFSORT


Code:


//STEP1    EXEC  PGM=ICEMAN                                             
//SYSOUT      DD SYSOUT=*                                               
//SORTIN      DD DSN=A.B.C,   * FB/LREC=133                               
//             DISP=SHR                                                 
//*INPUT FILE                                                           
//SORTOUT     DD DSN=A.B.D,                               
//             DISP=(OLD,CATLG,DELETE),                                 
//             UNIT=SYSDA,SPACE=(TRK,(300,75),RLSE),                   
//             DCB=(RECFM=FB,LRECL=150,BLKSIZE=0)                       
//SYSIN       DD * *** CONSTANT CONTROL CARDS ***                       
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=(1,5,CH,EQ,C'MONTH'),                               
     BUILD=(C'MNTH,''',11,6,C'''')),                                     
   IFTHEN=(WHEN=(1,4,CH,EQ,C'CODE'),                                   
     BUILD=(C'CODE,''',11,3,C'''')),                                     
   IFTHEN=(WHEN=(1,5,CH,NE,C'TOTAL'),                                   
     BUILD=(MNTH,CODE,1,133))                                           
/*                                                                     
//     
                                                                 


Please check the above job and please suggest me where i need to change in the above job.

Thx & Regards,
GNATH
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Thu May 10, 2007 10:27 am
Reply with quote

Hi Frank,

After submiting the above job i got the below error with RC=16

Code:


1ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                               
 ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 00:52 ON THU MAY
0            OPTION COPY                                                       
             INREC IFTHEN=WHEN=1,5,CH,EQ,C'MONTH'),                           
                BUILD=(C'MNTH,''',11,6,C'''')),                                 
              IFTHEN=(WHEN=(1,4,CH,EQ,C'CODE'),                               
                BUILD=(C'CODE,''',11,3,C'''')),                                 
              IFTHEN=(WHEN=(1,5,CH,NE,C'TOTAL'),                               
                BUILD=(MNTH,CODE,1,133))                                       
                       $                                                       
 ICE007A 1 SYNTAX ERROR                                                         
 ICE052I 3 END OF DFSORT                                                       


-GNATH[/code]
Back to top
View user's profile Send private message
ParagChouguley

Active User


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

PostPosted: Thu May 10, 2007 7:13 pm
Reply with quote

Hi Rguhanath,
I too have tried to solve your query as per my method.

Code:

//S1      EXEC PGM=ICETOOL                           
//TOOLMSG DD SYSOUT=*                               
//DFSMSG  DD SYSOUT=*                               
//IN1     DD DSN=  Input file LRECL=133                                 
//      DISP=SHR                                     
//OUT1    DD DSN= output file LRECL = auto decided
//      SPACE=(CYL,(1,1),RLSE),                     
//      DISP=(NEW,CATLG,DELETE)                     
//*     DISP=OLD                                     
//TEMP1   DD DSN=&&TEMP1,SPACE=(CYL,(1,1),RLSE),     
//     LRECL=170,DISP=(MOD,KEEP)                     
//TEMP2   DD DSN=&&TEMP2,SPACE=(CYL,(1,1),RLSE),     
//     LRECL=170,DISP=(MOD,KEEP)                     
//TEMP3   DD DSN=&&TEMP3,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TEMP4   DD DSN=&&TEMP4,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TEMP5   DD DSN=&&TEMP5,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TEMP6   DD DSN=&&TEMP6,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TEMP7   DD DSN=&&TEMP7,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TEMP8   DD DSN=&&TEMP8,SPACE=(CYL,(1,1),RLSE),       
//     LRECL=170,DISP=(MOD,KEEP)                       
//TOOLIN  DD *                                         
    COPY FROM(IN1) TO(TEMP1) USING(SRT1)                             
    COPY FROM(IN1) TO(TEMP1) USING(SRT2)                             
    COPY FROM(IN1) TO(TEMP2) USING(SRT3)                             
    COPY FROM(IN1) TO(TEMP3) USING(SRT4)                             
    COPY FROM(TEMP3) TO(TEMP4) USING(SRT5)                           
    SPLICE FROM(TEMP1) TO(TEMP8) ON(1,5,ZD) WITH(16,3)               
    COPY FROM(TEMP8) TO(TEMP5)                                       
    COPY FROM(TEMP4) TO(TEMP5)                                       
    SPLICE FROM(TEMP5) TO(TEMP6) ON(1,5,ZD) WITHALL WITH(20,133)     
    COPY FROM(TEMP6) TO(TEMP7)                                       
    COPY FROM(TEMP2) TO(TEMP7)                                       
    SORT FROM(TEMP7) TO(OUT1) USING(SRT6)                             
/*                                                                   
//SRT1CNTL DD *                                                       
    OPTION COPY                                                       
    INCLUDE COND=(1,5,CH,EQ,C'MONTH')                                 
    OUTREC FIELDS=(SEQNUM,5,ZD,START=01,INCR=01,3X,12,121)           
/*                                                                   
//SRT2CNTL DD *                                                       
    OPTION COPY                                                       
    INCLUDE COND=(1,4,CH,EQ,C'CODE')                                 
    OUTREC FIELDS=(SEQNUM,5,ZD,START=01,INCR=01,3X,7X,12,121)         
/*                                                                   
//SRT3CNTL DD *                                                       
    OPTION COPY                                                       
    INCLUDE COND=(1,5,CH,EQ,C'TOTAL')                                 
    OUTREC FIELDS=(SEQNUM,5,ZD,START=01,INCR=01,3X,1,133)             
/*                                                                   
//SRT4CNTL DD *                                                       
    OPTION COPY                                                       
    OMIT COND=(1,5,CH,EQ,C'MONTH',OR,                                 
               1,4,CH,EQ,C'CODE',OR,                                 
               1,5,CH,EQ,C'TOTAL',OR,                                 
               1,5,CH,EQ,C'     ')                                     
    OUTREC FIELDS=(SEQNUM,5,ZD,START=03,INCR=01,3X,11X,1,133)         
/*                                                                     
//SRT5CNTL DD *                                                       
    OPTION COPY                                                       
    OUTREC FIELDS=((1,5,ZD,DIV,+3),EDIT=(TTTTT),6,147)                 
/*                                                                     
//SRT6CNTL DD *                                                       
    SORT FIELDS=(1,5,ZD,A)                                             
/*                                                                     


Remember that all the temporary datasets should have DISP as MOD, as they are appended.
Moreover, this soln would work only for fixed number of records for a perticular month. currently it is 3. If they become 5, you have to replace 3 by 5 in your code. But this number should be preknown and constant.

Moreover, positions of fields in month and code record are important here.


Input file
Code:

           *
----+----1----+----2----+----3----+----4
MONTH    : 200704                 
CODE     : AAA                     
                                   
232LD2  23  3434.34               
34433D  32  3533.32               
645DSF  44  5434.43               
TOTAL    : 34323.34               
                                   
MONTH    : 200704                 
CODE     : AAA                     
                                   
232LD2  23  3434.34               
34433D  32  3533.32               
645DSF  44  5434.43               
TOTAL:34323.34                     
MONTH    : 200705       
CODE     : BBB           
                         
232DS2  23  3444.34     
3FS433  32  4533.32     
645DSF  44  5484.43     
TOTAL:3432323.34         
                         
MONTH    : 200705       
CODE     : CCC           
                         
23DSS2   23  6446.34     
3FSHH33  32  2533.32     
645DS43  44  5984.53     
TOTAL:345423.34         


Output file
Code:

00001   200704 AAA 232LD2  23  3434.34                 
00001   200704 AAA 34433D  32  3533.32                 
00001   200704 AAA 645DSF  44  5434.43                 
00001   TOTAL    : 34323.34                             
00002   200704 AAA 232LD2  23  3434.34                 
00002   200704 AAA 34433D  32  3533.32                 
00002   200704 AAA 645DSF  44  5434.43                 
00002   TOTAL:34323.34                                 
00003   200705 BBB 232DS2  23  3444.34                 
00003   200705 BBB 3FS433  32  4533.32                 
00003   200705 BBB 645DSF  44  5484.43                 
00003   TOTAL:3432323.34                               
00004   200705 CCC 23DSS2   23  6446.34                 
00004   200705 CCC 3FSHH33  32  2533.32                 
00004   200705 CCC 645DS43  44  5984.53                 
00004   TOTAL:345423.34                                 


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

DFSORT Developer


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

PostPosted: Thu May 10, 2007 8:50 pm
Reply with quote

Rguhanath,

Good grief. You've totally changed the requirement! In your original requirement you had ONE group of records with the Month, Code, Detail and Total records, so I gave you a simple solution involving symbols. I created the Symbols in my first step and used them in my second step.

Now you've totally changed the requirement to have MULTIPLE groups of records. That requires a completely different solution!

In your attempt at a solution, you threw away my first step and only used my second step. Since the first step that you threw away creates the symbols, and the second step that you kept uses the symbols, using just the second step obviously won't work since there are NO symbols. That's why you got the syntax error on the MNTH symbol - you never created it.

As for a solution for your new requirement, I need to know the approximate maximum number of groups of records you will have (where a group starts with MONTH and ends with TOTAL). Is it 20, 200, 2000 or what?
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Fri May 11, 2007 10:20 am
Reply with quote

Hi Frank,

I am Sorry. Actually i think this is small thing to do in jcl. but after implementaton with your code, i come to know its not work to my actuall requirement. so thats why i am again post my new requirement.

as per your query, the maximum number of groups of records will be vary depending on the input file. and the group of records also varying(after CODE to befor TOTAL records). so the constant records are only the MONTH and CODE records. below i am given my requirement.

Code:


MONTH    : 200704                 
CODE     : AAA                     
                                   
232LD2  23  3434.34               
34433D  32  3533.32               
645DSF  44  5434.43               
TOTAL    : 34323.34               
                                   
MONTH    : 200704                 
CODE     : AAA                     
                                   
232LD2  23  3434.34               
34433D  32  3533.32               
645DSF  44  5434.43               
74433D  32  3333.32               
646DSF  44  5634.43               
TOTAL:34323.34         
           
MONTH    : 200705       
CODE     : BBB           
                         
232DS2  23  3444.34     
3FS433  32  4533.32     
TOTAL:3432323.34         
                         
MONTH    : 200705       
CODE     : CCC           
                         
23DSS2   23  6446.34     
3FSHH33  32  2533.32     
645DS43  44  5984.53     
23RSS2   23  6446.34     
TOTAL:345423.34         
........
.......
.......
.......
.......



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

DFSORT Developer


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

PostPosted: Sat May 12, 2007 12:42 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/133)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,PASS)
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT DD DSN=... output file (FB/133)
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
SPLICE FROM(T1) TO(T3) ON(145,8,ZD) WITH(8,3)
SPLICE FROM(CON) TO(OUT) ON(145,8,ZD) -
  WITHALL WITH(12,133) USING(CTL2)
/*
//CTL1CNTL DD *
  OMIT COND=(1,12,CH,EQ,C' ')
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'MONTH'),
                OVERLAY=(134:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(142:SEQNUM,8,ZD,
                         134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=T1,
    INCLUDE=(1,5,CH,EQ,C'MONTH',OR,1,4,CH,EQ,C'CODE'),
    IFTHEN=(WHEN=(1,5,CH,EQ,C'MONTH'),
      BUILD=(11,6,145:134,8)),
    IFTHEN=(WHEN=(1,4,CH,EQ,C'CODE'),
      BUILD=(8:11,3,145:134,8))
  OUTFIL FNAMES=T2,
    OMIT=(1,5,CH,EQ,C'MONTH',OR,1,4,CH,EQ,C'CODE'),
    BUILD=(12:1,133,145:134,8)
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,
    IFOUTLEN=133,
    IFTHEN=(WHEN=(12,5,CH,EQ,C'TOTAL'),
      BUILD=(12,133))
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top