Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert DATE & COUNT to packed decimal S(9) comp-3 in DF
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Sat Aug 20, 2011 4:29 pm    Post subject: Convert DATE & COUNT to packed decimal S(9) comp-3 in DF
Reply with quote

i am in need to convert the the system date created during runtime into the packed decimal of S(9) COMP-3 field.

i have control statement in my sort card as:

Code:
HEADER1=(1:'HDR',4:DATE=(MD4-))

TRAILER1=(1:'TLR',10:COUNT=(EDIT(IIIT)))


I want to rewrite these statements by getting PD format of date at position 4.

And number of records processed in input file except TLR and HDR, at 10th position in packed decimal of S9(09) COMP-3.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Aug 22, 2011 8:23 pm    Post subject:
Reply with quote

rohanthengal,
Is it safe to assume that you want Packed decimal date in the header record only and not on all the records? If possible, please show an example of input record and expected output along with LRECL and RECFM for the input file. What is your Date format? YYYYMMDD or MMDDYYYY or what?

I see a post from you in the JCL section, do you have Syncsort or DFSort?

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Aug 22, 2011 8:32 pm    Post subject:
Reply with quote

rohanthengal
Have you tried executing your sort card shown to us? It is not correct syntax...
Code:
10:COUNT=(EDIT(IIIT)))
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Mon Aug 22, 2011 8:34 pm    Post subject:
Reply with quote

hi sqlcode1...
your solution to my previous query worked well.. thanks buddy !
actually i am away from my mainframe. working from personal station.
but as far as i remember and u reminded me, i think all the fields in the output file need to be mapped to s(9) comp-3 for which i have got the solution using outrec and converting to packed decimal..
but i am not able to convert the above mentioned fields to PD.

problem is i am using the functions like DATE and COUNT which give me output in numeric format but can i convert them to S9(9) comp-3 ?
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Mon Aug 22, 2011 8:51 pm    Post subject:
Reply with quote

esacapa, yeah it was working..
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Aug 22, 2011 9:05 pm    Post subject:
Reply with quote

rohanthengal wrote:
esacapa, yeah it was working..

It will only after you give comma after HEADER1 statement..
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Mon Aug 22, 2011 9:15 pm    Post subject:
Reply with quote

you are right escapa..
actually i removed outrec statements in between and pasted only required those, as i wanted to convert them i.e. DATE and COUNT into PD of S9(9) COMP-3
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Aug 22, 2011 9:32 pm    Post subject:
Reply with quote

rohanthengal,
Quote:
but as far as i remember and u reminded me, i think all the fields in the output file need to be mapped to s(9) comp-3 for which i have got the solution using outrec and converting to packed decimal..
but i am not able to convert the above mentioned fields to PD.


If you already have date populated in required format why not just use that in HEADER1? For example, if you have date populated in packed decimal format at nth position, you would just use HEADER1=(1:'HDR',N,5)). You can get count in TRAILER1 using 10:COUNT=(TO=PD,LENGTH=5)

So use something like below...(UNTESTED)
Code:
OUTFIL REMOVECC,HEADER1=(1:'HDR',4:N,5),     --> N is where you already have date populated in PD
TRAILER1=(1:'TRL',10:COUNT=(TO=PD,LENGTH=5)) --> Based on your original sort card,I am assuming you want count at 10th position

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

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Mon Aug 22, 2011 11:02 pm    Post subject: Reply to: Convert DATE & COUNT to packed decimal S(9) co
Reply with quote

thanks for letting me know about COUNT in trailer !

Also,, can you please let me know the technique in your mind to convert DATE also to PD of S9(9) comp-3 at 4th position in HEADER after 'HDR' ?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Aug 22, 2011 11:56 pm    Post subject:
Reply with quote

rohanthengal,
rohanthengal wrote:
thanks for letting me know about COUNT in trailer !

Also,, can you please let me know the technique in your mind to convert DATE also to PD of S9(9) comp-3 at 4th position in HEADER after 'HDR' ?
One method(which I already told you above) is to use already populated date from "detail" record and populate the same on HEADER record. Remember, if you already have Date populated in the input file in packed decimal format, you don't need INREC OVERLAY.

I am "guessing" that you don't have date populated in packed decimal format for "detail" records based on below comment...
Quote:
i think all the fields in the output file need to be mapped to s(9) comp-3

If that is the case,I would write something like below. If you need something specific please provide test records and expected output when you get to the mainframe.
Code:
//STEP0001 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD  *                                           
SQLCODE IS                                                 
TESTING                                                     
"DATE"                                                     
FOR HEADER                                                 
AND TRAILER                                                 
RECORDS                                                     
//SORTOUT  DD  SYSOUT=*                                     
//SYSIN    DD *                                             
 INREC OVERLAY=(15:DATE1P)                                 
 SORT FIELDS=COPY                                           
 OUTFIL REMOVECC,HEADER1=(C'HDR',15,5),                     
                 TRAILER1=(C'TRL',10:COUNT=(TO=PD,LENGTH=5))
/*                                                         


OUTPUT
Code:
000001 HDR   b               
       CCD00182444444444444444
       8492102C000000000000000
------------------------------
000002 SQLCODE IS       b     
       EDDCDCC4CE4444001824444
       283364509200002102C0000
------------------------------
000003 TESTING          b     
       ECEECDC4444444001824444
       352395700000002102C0000
------------------------------
000004 "DATE"           b     
       7CCEC744444444001824444
       F4135F000000002102C0000
------------------------------
000005 FOR HEADER       b     
       CDD4CCCCCD4444001824444
       669085145900002102C0000
------------------------------
000006 AND TRAILER      b     
       CDC4EDCCDCD444001824444
       154039193590002102C0000
------------------------------
000007 RECORDS          b     
       DCCDDCE4444444001824444
       953694200000002102C0000
------------------------------
000008 TRL          %         
       EDD44444400006444444444
       3930000000000C000000000
------------------------------


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

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Aug 23, 2011 1:13 am    Post subject:
Reply with quote

rohanthengal,

I'd suggest this is a better way to do what you want with DFSORT. It's sets up the PD date as a symbol and then uses it only in HEADER1.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,BUILD=(DATE1P)),
   IFTHEN=(WHEN=INIT,BUILD=(C'PDATE,C''',1,5,C''''))
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,HEADER1=(1:'HDR',4:PDATE),
  TRAILER1=(1:'TLR',10:COUNT=(TO=PD,LENGTH=5))
/*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 23, 2011 3:14 pm    Post subject:
Reply with quote

Hi Frank.. Just curiosity


Will below two have any performance difference...
Code:

//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,BUILD=(DATE1P)),
   IFTHEN=(WHEN=INIT,BUILD=(C'PDATE,C''',1,5,C''''))
/*

Code:

//SYSIN DD *                                               
  OPTION COPY                                               
  INREC IFOUTLEN=80,                                       
  IFTHEN=(WHEN=INIT,BUILD=(C'PDATE,C''',DATE1P,C''''))     
/*                                                         

Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Aug 23, 2011 7:34 pm    Post subject: Reply to: Convert DATE & COUNT to packed decimal S(9) co
Reply with quote

hi sqlcode1, i tested the things..
it is populating the date in yyyymmdd format as packed decimal in HEADER. Thanks a lot.

Also i am able to convert the count in trailer to PD.
but can you please clarify whether it will populate the date in deatil record as well ? also is it possible to convert the date in mmddyyyy format ?
i want the date only in HEADER.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Aug 23, 2011 8:07 pm    Post subject:
Reply with quote

Frank, i got your point but my constraint is to use only one step.
So i used sqlcode1's SORT card but i am worried if it adds date at 15th position of each detailed record which i dont need. I want to populate in only HEADER.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Aug 23, 2011 8:29 pm    Post subject: Re: Reply to: Convert DATE & COUNT to packed decimal S(9
Reply with quote

rohanthengal,
rohanthengal wrote:
Also i am able to convert the count in trailer to PD.
but can you please clarify whether it will populate the date in deatil record as well ?

Yes and you don't want to use the card, I provided for the same reason.
rohanthengal wrote:
also is it possible to convert the date in mmddyyyy format ?
i want the date only in HEADER.
you could have mentioned this yesterday!!!

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 23, 2011 8:35 pm    Post subject:
Reply with quote

rohanthengal wrote:
[...]

my constraint is to use only one step.

[...]


Sorry, but that is absurd. One step is to generate a little itsy-bitsy piece of data to be on the SYMNAME in the next step, where your data is actually processed.

And you're not allowed to do it? Please, ask the placer of this constraint to provide you with an explanation as to why not, and then, if you like, pass that on to us.
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Aug 23, 2011 8:39 pm    Post subject:
Reply with quote

ok sqlcode1, sorry for the mistake..
my sort card has become something like this:
Code:
INREC OVERLAY = (15:DATE1P)
SORT FIELDS = COPY
HEADER1....
OUTREC.... used to map the input fields to the output fields.
TRAILER1..

As per my today's run, i could not see DATE populated in detailed records but in HEADER i could see DATE.

I think DATE populated in detailed records are overwritten by OUTREC statements specified between HEADER and TRAILER.

Am i on right track ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Aug 23, 2011 9:03 pm    Post subject:
Reply with quote

Hello,

Quote:
i got your point but my constraint is to use only one step.
What business requirement does this support . . . icon_confused.gif

Why would it matter if a new process is run in one or two steps?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Tue Aug 23, 2011 9:04 pm    Post subject:
Reply with quote

rohanthengal,
How do you expect anyone to make even an educated guess with such "constraint" and that too when you haven't really provided any test data.

INREC OVERLAY = (15:DATE1P). This statement overlays whatever data that is present on 15th position. So if you input is 14 byte LRECL, then you are fine otherwise you are accidently overlaying some fields.

If you are not selecting this date in the OUTFIL OUTREC, and if this looks correct to you, you may be right. I don't have access to your data or requirements, so I can't really say much.

However, this doesn't help you in getting date in correct format.

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

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Aug 23, 2011 10:31 pm    Post subject: Reply to: Convert DATE & COUNT to packed decimal S(9) co
Reply with quote

thanks all for your inputs. Will surely try by negotiating with placer.

sample input
Code:
10001    JOHN BRIAN
10002    ASHLEY GILES
10008    STEFFY SHAW


sample output
Code:
HDR   08242011
10001    JOHN BRIAN
10002    ASHLEY GILES
10008    STEFFY SHAW
TLR    3


Now the only issue remains is DATE format which was populated in yyyymmdd format but shop needs mmddyyyy and that too in PD.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us