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

Printing previous date and blank rows


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

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Sep 26, 2013 5:33 pm
Reply with quote

I want to print name of previous month like "Sep 2013" if job run on 1st of October,in my header.
Also i want two blanks rows after my first header,i am already using two headers and two trailer.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Sep 26, 2013 5:57 pm
Reply with quote

Hello,
Pls post

the input file layout,
expected output file sample,
input & output file dataset attributes.
the name of the sort product that you have.
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Sep 26, 2013 7:21 pm
Reply with quote

I am using DFSORT

This job will run on 1st of every month.I am already done with the report preparation i just stuck with the header part.I want to print month name and year like "sep 2013" somewhere in header.So my heading will look like below

"Mailbox for EFT transaction on us (&prev-month current year)"

Please advise what keywords shall i use to do this.
Also i want two blank rows after the header to make the report more readable.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 26, 2013 9:08 pm
Reply with quote

Hello and welcome to the forum,

You will get to what you want more quickly if you post all of the info requested. . .

Please post a sample of your output so far and an example what you want. I believe we understand, but it is so much easier to see with an example.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 01, 2013 1:23 am
Reply with quote

trushant.w,

Use the following. It doesn't matter when you run the job, you will always get the last month.

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
                                                                 
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,BUILD=(DATE2-1,80:X)),     
  IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=5,                         
   INOUT=(C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',C'04',C'APR',   
          C'05',C'MAY',C'06',C'JUN',C'07',C'JUL',C'08',C'AUG',   
          C'09',C'SEP',C'10',C'OCT',C'11',C'NOV',C'12',C'DEC')))
                                                                 
  OUTFIL REMOVECC,NODETAIL,                                     
  HEADER1=('MAILBOX FOR EFT TRANSACTION ON US ',5,3,X,1,4,/,/)   
//*                                                             
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Tue Oct 01, 2013 5:23 pm
Reply with quote

Hi Skolusu

Thanks for reply!!

But it looks like as i am already using the build function for other calulations this is not getting proper result.
I am unable to print like"Sep 2013" also my other calculation also getting effected.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 01, 2013 5:39 pm
Reply with quote

Kolusu has shown you how to turn a file containing a single blank line into the date that you require.

Neither he nor anyone else is looking over your shoulder to see what other code you have.

You are expected to take the working code provided by Kolusu and apply it to your code.

You will need to append (fixed-length data) or prepend (variable-length data) the formatted date to each record.

Firstly, fully understand Kolusu's code.

Secondly, apply it to your existing code so that it causes no upsets.

If you have problems, post your code, sample input, oiutput produced by the sample and output expected.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Oct 01, 2013 6:44 pm
Reply with quote

Quote:
But it looks like as i am already using the build function for other calulations this is not getting proper result.
I am unable to print like"Sep 2013" also my other calculation also getting effected.

Hello,
How do you expect us to give you a solution that matches your requirement, unless you share what you have tried, input, output record structure?
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Tue Oct 01, 2013 8:19 pm
Reply with quote

I am using below code

Code:
 INREC IFTHEN=(WHEN=(20,11,ZD,LT,500000000),                         
   BUILD=(20,11,12:3X,15:C'1',16:4X,11C'0',31:4X,35:C'0',36:2X,       
          38:DATE2-1)),FINDREP=(STARTPOS=42,                           
    INOUT=(C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',C'04',C'APR',       
           C'05',C'MAY',C'06',C'JUN',C'07',C'JUL',C'08',C'AUG',       
           C'09',C'SEP',C'10',C'OCT',C'11',C'NOV',C'12',C'DEC'))),     
*                                                                     
  IFTHEN=(WHEN=NONE,                                                   
      BUILD=(11C'0',12:3X,1C'0',16:4X,20:20,11,31:4X,35:C'1',36:2X,   
      38:DATE2-1)),                                         



but i am getting below error
Code:

ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS
             INOUT=(C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',C'04',C'APR',     
             $


Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 01, 2013 9:47 pm
Reply with quote

You can't have more than one function on a single IFTHEN. So you can't have BUILD and FINDREP on the same IFTHEN,

If you look at Kolusu's example, he has one WHEN=INIT store the date and another WHEN=INIT to do the FINDREP.

Why don't you use that approach to extend your input records with the date attached to the end of the record, and then specify that position for your date when you do the BUILDs later?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 01, 2013 10:25 pm
Reply with quote

trushant.w,

Use the following code.

Code:
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=(20,11,ZD,LT,500000000),                       
     BUILD=(20,11,12:3X,15:C'1',16:4X,11C'0',31:4X,35:C'0',36:2X)),
  IFTHEN=(WHEN=NONE,                                               
     BUILD=(11C'0',12:3X,1C'0',16:4X,20:20,11,31:4X,35:C'1',36:2X))
                                                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(38:DATE2-1,2X)),               
  IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=42,                           
      INOUT=(C'01',C'JAN',C'02',C'FEB',C'03',C'MAR',C'04',C'APR',   
             C'05',C'MAY',C'06',C'JUN',C'07',C'JUL',C'08',C'AUG',   
             C'09',C'SEP',C'10',C'OCT',C'11',C'NOV',C'12',C'DEC')))
                                                                   
  OUTFIL REMOVECC,BUILD=(1,37,80:X),                               
  HEADER1=('MAILBOX FOR EFT TRANSACTION ON US ',42,3,X,38,4,/,/)   
//*
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Oct 03, 2013 8:15 pm
Reply with quote

Thank you very much Skolusu.... icon_biggrin.gif
Thanks for your input Bill.
I am now getting the exact report.

But i am unable to understand the significance of BUILD in OUTFIL
I tried without that BUILD in OUTFIL but its not working
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 03, 2013 8:39 pm
Reply with quote

Well, what it does when you take the BUILD off (and assuming you took off the comma on the previous line) is a very big clue to the reason for having it.

So, what output do you get when you take off the BUILD? Can you work out what those unexpected things are and relate it to the earlier code in the Control Cards?
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top