|
View previous topic :: View next topic
|
| Author |
Message |
trushant.w
New User
.jpg)
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
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 |
|
 |
vasanthz
Global Moderator

Joined: 28 Aug 2007 Posts: 1753 Location: Tirupur, India
|
|
|
|
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 |
|
 |
trushant.w
New User
.jpg)
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
trushant.w
New User
.jpg)
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
vasanthz
Global Moderator

Joined: 28 Aug 2007 Posts: 1753 Location: Tirupur, India
|
|
|
|
| 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 |
|
 |
trushant.w
New User
.jpg)
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
trushant.w
New User
.jpg)
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Thank you very much Skolusu....
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|