getting current year while using SORT PROC



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

getting current year while using SORT PROC

Postby pradeep007 » Tue May 18, 2010 10:03 pm

In a JCL using SORT PROC, I was concatenating some datasets(SORTIN) and writing to O/P(SORTOUT). The O/P dataset should have current year minus one in heading - which I was specifying in SYSIN, but some how ending with error. Please help me with this.
pradeep007
 
Posts: 5
Joined: Mon Feb 15, 2010 8:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting current year while using SORT PROC

 

Re: getting current year while using SORT PROC

Postby dick scherrer » Tue May 18, 2010 11:24 pm

Hello and welcome to the forum,

So, what have you posted that someone can use to help you? Umm, ahhh, welll, pretty much nothing. . .

You need to post some sample input, sample output from that input, and the "rules for getting from the input to the output. You also need to post the jcl and control statements you used along with the diagnostic information.

Also mention the dsorg and lrecl of all files.

Use the "Code" tag to preserve alignment.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: getting current year while using SORT PROC

Postby pradeep007 » Tue May 18, 2010 11:34 pm

I just want syntax for retrieving system date(year specifically) subtract 1 from that. That's it.
pradeep007
 
Posts: 5
Joined: Mon Feb 15, 2010 8:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting current year while using SORT PROC

Postby dick scherrer » Wed May 19, 2010 1:12 am

Hello,

And we just want to you learn/follow the proper way to ask for help. . .

So, post the requested info. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: getting current year while using SORT PROC

Postby pradeep007 » Wed May 19, 2010 12:34 pm

ok, here is code snippet

//STEP04 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&TEMP1,DISP=(OLD,DELETE,DELETE)
// DD DSN=&&TEMP2,DISP=(OLD,DELETE,DELETE)
// DD DSN=&&TEMP3,DISP=(OLD,DELETE,DELETE)
//SORTOF1 DD DSN=P8768.T3.STATE.FILE,DISP=SHR
//* DISP=(NEW,CATLG),
//* SPACE=(TRK,(1,5),RLSE),UNIT=DISK,
//* DCB=(RECFM=FB,BLKSIZE=27920,LRECL=80)
//SORTOF2 DD DUMMY
//SYSIN DD *
OPTION COPY
OUTFIL FILES=1,
HEADER1=(1:' ',/,
22:'Heading here followed by (here I want current year minus one)',/,
1:' '),
REMOVECC
/*

Temp dataset attributes are same as of SORTOF1
pradeep007
 
Posts: 5
Joined: Mon Feb 15, 2010 8:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting current year while using SORT PROC

Postby Frank Yaeger » Wed May 19, 2010 10:59 pm

You can use a DFSORT job like the following to do what I think you're asking for:

//SETSYM EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
CURYR,S'&YR4.'
//SORTIN DD *
RECORD
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,BUILD=(CURYR)),
     IFTHEN=(WHEN=INIT,
       BUILD=(C'PREVYR,''',1,4,ZD,SUB,+1,EDIT=(TTTT),C'''',80:X))
//STEP04 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN   DD DSN=&&TEMP1,DISP=(OLD,DELETE,DELETE)
//         DD DSN=&&TEMP2,DISP=(OLD,DELETE,DELETE)
//         DD DSN=&&TEMP3,DISP=(OLD,DELETE,DELETE)
//SORTOF1  DD DSN=P8768.T3.STATE.FILE,DISP=SHR
//*           DISP=(NEW,CATLG),
//*           SPACE=(TRK,(1,5),RLSE),UNIT=DISK,
//*           DCB=(RECFM=FB,BLKSIZE=27920,LRECL=80)
//SORTOF2  DD DUMMY
//SYSIN DD *
  OPTION COPY
  OUTFIL FILES=1,
    HEADER1=(1:' ',/,
   22:'HEADING HERE FOLLOWED BY ',PREVYR,/,
     1:' '),
   REMOVECC
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: getting current year while using SORT PROC

Postby dick scherrer » Thu May 20, 2010 1:00 am

Hello,

ok, here is code snippet
But you did not post the diagnostic information showing all of the messages and the message ids :(

When you want help (whether it is here or at various vendor support sites) you need to provide as complete information as possible on the first iteration. In the long run, it is mostly your time that is saved. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: getting current year while using SORT PROC

Postby pradeep007 » Thu May 20, 2010 9:05 am

Thanks Frank it helped, but can that be done in one step instead of two.

Once again thanks alot for helping, Frank.

Also, thanks to Dick for his timely helpful suggestions.
pradeep007
 
Posts: 5
Joined: Mon Feb 15, 2010 8:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: getting current year while using SORT PROC

Postby Frank Yaeger » Thu May 20, 2010 10:45 pm

but can that be done in one step instead of two.


Why? The first step only reads and writes one record. Why is that a problem?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: getting current year while using SORT PROC

Postby pradeep007 » Fri May 21, 2010 1:14 pm

Frank Yaeger wrote:
Why? The first step only reads and writes one record. Why is that a problem?


Just wondering, if by including some lines in SYSIN of my STEP will do the job.
pradeep007
 
Posts: 5
Joined: Mon Feb 15, 2010 8:21 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post