How to include Year in Header1



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Re: How to include Year in Header1

Postby ankushgattani » Tue Sep 04, 2012 3:50 pm

we can do that using SYMNAMES:
Sortstep1: generate year and save the record into SYMVAR
Sortstep2: use the SYMVAR to write the year in the HEADER1.

But even this will need two steps.
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby bodatrinadh » Tue Sep 04, 2012 5:06 pm

Hi Ankush,

You can do it in single step...

//SYSPRINT DD SYSOUT=*                                             
//SYSOUT DD SYSOUT=*                                               
//SYMNAMES DD *                                                     
YEAR4,S'&LYR4'                                                     
//SORTIN  DD *                                                     
3NADH.TXT                                                           
CD AAAAAA                                                           
CD BBBBBB                                                           
CD CCCCCCC                                                         
CD DDDDDDD                                                         
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0         
GET                                                       +         
USER.NONX.USER9999.SAMPLE(+1)'                                     
QUIT                                                               
//SORTOUT DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  OUTFIL HEADER1=(YEAR4)                                           


And your Output will be :-

2012   ==> Current Year
3NADH.TXT                                         
CD AAAAAA
CD BBBBBB
CD CCCCCCC
CD DDDDDDD
LOCSITE PRI=5 CY SEC=1 CY U=TESTDA REC=FB LR=1402 BLOCKSI=0
GET                                                       +
USER.NONX.USER9999.SAMPLE(+1)'
QUIT
Thanks
-3nadh

These users thanked the author bodatrinadh for the post:
ankushgattani (Thu Sep 06, 2012 3:22 pm)
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: How to include Year in Header1

Postby ankushgattani » Tue Sep 11, 2012 3:51 pm

Thanks Bodatrinadh

That worked fine.
But there is one issue, the output year comes in Character format. I need it in decimal format (ZD), as i have to subtract 1 from it and copy it to new file.
i tried this in OUTFILE HEADER1, didn't work, gave me syntax error
YEAR4,TO=ZD


--> Writing another sort card to generate CURRENTYEAR - 1 (2012 - 1 = 2011) is also fine by me.
I tried to do using the following SYMNAMES, but couldnt get the desired result.

YEAR4,S'&LYR4'-1
This job abended
and
YEAR4,S'&LYR4-1'
This job printed "2012-1".
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby ankushgattani » Wed Sep 12, 2012 11:30 am

I got the Answer:

I can subtract one from 2012 (in character format) using the following code:
Input data is:
xx2012xx

The overlay for output record can be defined as
Overlay=(1,2,(3,4,ZD,SUB,+1),M7,LENGTH=4,7,2)
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby BillyBoyo » Wed Sep 12, 2012 12:26 pm

You are defining it as ZD, not character (CH).

You don't need an EDIT mask if you just want simple digits.The parenthesis/brackets are not a bad idea, but I'd include the LENGTH= inside.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to include Year in Header1

Postby ankushgattani » Thu Sep 13, 2012 11:29 am

I tried
Overlay=(1,2,(3,4,ZD,SUB,+1),7,2)


But it gave me SPACES in place of "Year-1"
xx    xx


expected output was
xx2011xx
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby ankushgattani » Thu Sep 13, 2012 11:32 am

this is my input reord with HEX ON

XX2012XX
EEFFFFEE444444444444444444444444444444444444444444444444444444444444444
77201277000000000000000000000000000000000000000000000000000000000000000
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby BillyBoyo » Thu Sep 13, 2012 11:43 am

OVERLAY=(1,2,(3,4,ZD,SUB,+1,LENGTH=4),7,2)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to include Year in Header1

Postby ankushgattani » Thu Sep 13, 2012 12:28 pm

when i use
  OVERLAY=(1,2,(3,4,ZD,SUB,+1,LENGTH=4),7,2)

i get the following error
SYSIN :                                     
  OPTION COPY                               
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'x'),       
  OVERLAY=(1:C'1',X,(3,4,ZD,SUB,+1,LENGTH=4),7,2)
                                  *         
  OUTFILE REMOVECC                           
WER268A  INREC STATEMENT   : SYNTAX ERROR   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000


Without Parenthesis, The job runs fine, but it doesnt give the required output:
  OVERLAY=(1,2,3,4,ZD,SUB,+1,LENGTH=4,7,2)

the output is
xx011 xx
ankushgattani
 
Posts: 30
Joined: Wed Aug 29, 2012 12:20 pm
Has thanked: 3 times
Been thanked: 0 time

Re: How to include Year in Header1

Postby BillyBoyo » Thu Sep 13, 2012 1:18 pm

You had it working.

I thought the brackets were a nice idea, I've never used them like that.
I would do 3,4,ZD,SUB,+1,TO=ZD,LENGTH=4


I could "guess" (no Syncsort manual) that

(3,4,ZD,SUB,+1),TO=ZD,LENGTH=4


Would be as far as the brackets can get.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Previous

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post