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

SORT to add (replace) date in Julian format


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

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon May 12, 2014 2:25 pm
Reply with quote

Hi,

I have a static file which I want to use daily. However, I want to change the date (julian format) to current date before I use it.

apart from other records, I have three records where I have date in julina formant and I want to change the date using sort.

----+----1----+----2----+----3----+----4
90Ðå48408514100 000014100N0300TEST00000
91 004840851410000000000000000000000000
92 004840851410000000000000000000000000

Date is on record type (column 1, length2, CHAR) 90, 91 and 92
File is FB and LRECL 170
above julian date is 14100 (YYDDD). It occurs twice on record type 90 (column 11 and 22) and once on record type 91 and 92, column 13.

I want to write a sort card to change this date to current system date.

Thanks,
zh_lad
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon May 12, 2014 2:42 pm
Reply with quote

It's a temporary fix to handle 'file not arriving' scenario. Will be taken off once sending system is ready.

Once I know the solution, I will try to get this date from a date file.

Hope I have answered your questions.
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: Mon May 12, 2014 3:46 pm
Reply with quote

You missed the irony.

I think the generate-the-symbol approach is easiest, even for a once-off.

Have one step with SYSIN DD * and "SOMETHING, NOT RELEVANT" as the data.

OPTION COPY,STOPAFT=1
INREC to get julian date, and format it as a symbol on a symbol file.

Remember to create 80-byte records, so have 80:X at the end of your BUILD.

In your actual step, include DD for SYMNAMES which dataset from SORTOUT from above step, SYMNOUT DD so that you can see what is being used.

Then, on INREC, just identify each record, and OVERLAY the symbol's value in the appropriate place(s) for each record.

If it is a once-off, why not hard-code it, but that is another question....
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon May 12, 2014 4:45 pm
Reply with quote

I will come back to above solution. Mean while, I have used below sort card to extract current system date:

Input:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå48408514100  000014100N0300TEST00000000001000000000
91  004840851410000000000000000000000000000000000100000
92  004840851410000000000000000000000000000000000100000


SORT Card
Code:
OPTION COPY                               
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),   
             OVERLAY=(12:DATE1,22:DATE1)),
       IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),   
             OVERLAY=(13:DATE1)),         
       IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),   
             OVERLAY=(13:DATE1))         


Output:
Code:
----+----1----+----2----+----3----+----4----+----5----+
*******************************************************
90Ðå484085120140512002014051200TEST00000000001000000000
91  004840852014051200000000000000000000000000000100000
92  004840852014051200000000000000000000000000000100000


DATE1 is overlaying date in CCYYMMDD format. Is there a current date operand to overlay date in julian format?

I found something on Date Conversion line..
Code:
OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),       
             OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))


But it does not work.

Many thanks.
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: Mon May 12, 2014 5:06 pm
Reply with quote

Y4 means a four-digit year. Y2 means a two-digit year. Is that the only problem? "It does not work" is never very helpful if we don't know exactly how it didn't work for you. I'm sure that Y4U does work.
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon May 12, 2014 6:23 pm
Reply with quote

It was giving below error:
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12
            OPTION COPY                                       
            OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),             
                         OVERLAY=(12:DATE1,Y4T,TOJUL=Y4U))     
                                           £                   
ICE006A 0 OPERAND DEFINER ERROR                                 


I understand DATE1 is C'yyyymmdd' and Y4T is C'ccyymmdd', still it is giving Operand define error. Can you please advice? Thanks
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: Mon May 12, 2014 6:53 pm
Reply with quote

The Fine Manual wrote:
p,m,Y2x or p,m,Y4x
Specifies that an input date field is to be edited.


Now, is DATE1,Y4T of the format p,m,Y4T?

Code:
             OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),             
                         OVERLAY=(12:DATE1,
                                  12:12,8,TOJUL=Y4U))


Experiment along those lines.

You will lose a byte of your data, so extend your record temporarily to include DATE1 at the new location, then put it, converted, into column 12.
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: Mon May 12, 2014 6:58 pm
Reply with quote

Perhaps you should look here and cut out the middleman, just using system symbols. Give it a whirl.
Back to top
View user's profile Send private message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon May 12, 2014 8:09 pm
Reply with quote

Thanks Bill. While you replied, worked on solution you suggested initially, using SYMNAMES. So far I had never used SYMNAMES, though I have seen people using it.

SYMNAMES is the easiest solution. Here is my JCL

Step one to extract julian date from calender file (pos 15, L 5)
Code:
//STEP001  EXEC PGM=SORT                                           
//SORTIN   DD DISP=SHR,DSN=my calendar file
//SORTOUT  DD DSN=my symbol file,                   
//            DISP=(,CATLG),SPACE=(TRK,(1,1))                     
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC BUILD=(C'MYDATE,''',15,5,C'''',80:X)                       
//SYSOUT   DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=*                                             


and later using symbol MYDATE
Code:
//STEP002  EXEC PGM=SORT                               
//SYMNAMES DD DISP=SHR,DSN=my symbol file
//SORTIN   DD DISP=SHR,DSN=my input file
//*                                                   
//SORTOUT  DD DSN=output with edited julian date,
//            DISP=(,CATLG),SPACE=(TRK,(5,2))         
//SYSIN    DD *                                       
  OPTION COPY                                         
  OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'90'),               
               OVERLAY=(11:MYDATE,22:MYDATE)),         
         IFTHEN=(WHEN=(1,2,CH,EQ,C'91'),               
               OVERLAY=(13:MYDATE)),                   
         IFTHEN=(WHEN=(1,2,CH,EQ,C'92'),               
               OVERLAY=(13:MYDATE))                   
//SYSOUT   DD SYSOUT=*                                 
//SYSUDUMP DD SYSOUT=*                                 


It worked well!

Thanks.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top