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
 

 

Validating the Trailer in DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ashakant4u

New User


Joined: 11 Apr 2008
Posts: 5
Location: pune

PostPosted: Sun Apr 13, 2008 2:22 pm    Post subject: Validating the Trailer in DFSORT
Reply with quote

Hi All,

I am a new member to the Forum.

I need some help Regarding the DFSORT Utility.


My Requirement:
--------------------

I have an input file which has Header Record, Detail Record and Trailer Record. In my Sort out put file i want the same header and the detail record should have the ATM Transaction only and the Trailer should have the Record Count which is the second field After the Record Type.

My jcl for the above scenario
---------------------------------

//PS010 EXEC PGM=SORT
//SORTIN DD DSN=input. file ,DISP=SHR
//SORTOUT DD DSN=output.file,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(20,20),RLSE),
// DCB=(RECFM=FB,LRECL=1067,DSORG=PS)
//SYSIN DD *
INCLUDE COND=(1,1,CH,EQ,C'A') =====> copying the Header(A)
SORT FIELDS=(COPY)
/*
//PS020 EXEC PGM=SORT
//SORTIN DD DSN=input. file ,DISP=SHR
//SORTOUT DD DSN=output.file,
// DISP=MOD

//SYSIN DD *
SORT FIELDS=(COPY)
INCLUDE COND=((30,1,CH,EQ,C'A'),AND, ====> 'A'==> Tran Type
(1,1,CH,EQ,C'D')) ====> 'D'==> Detl Rec
OUTFIL FNAMES=SORTOUT,REMOVECC,
IFTHEN=(WHEN=(1,1,CH,EQ,C' '),OVERLAY=(1:C'T')), ==>'T'==TRLR Rec
TRAILER1=(C'T',COUNT=(M11,LENGTH=15))
/*

could you pls let me know if the above code is correct??
pls let me know why we use REMOVECC???
can the cbove code be done in one step??


Before this i want to validate the Trailer count of the input file(SORTIN)
against the Sort Count.

pls help me how to do this


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

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Sun Apr 13, 2008 3:34 pm    Post subject: Reply to: Validating the Trailer in DFSORT
Reply with quote

asha,

Hi and welcome to the forums.

Instead of posting the JCL could you post the sample input and output?



Quote:
pls let me know why we use REMOVECC???
Quote:


Removecc is for removing the extra bytes at the start of the record (carriage control bytes)
Back to top
View user's profile Send private message
ashakant4u

New User


Joined: 11 Apr 2008
Posts: 5
Location: pune

PostPosted: Sun Apr 13, 2008 3:59 pm    Post subject: Reply to: Validating the Trailer in DFSORT
Reply with quote

Hi Aaru,

input file is like this:
A2008-01-010000000000000000000 =====>header
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p ==========> Detail Record
T00000000000000800000000000000 ===========> Trailer Record

As per my sort steps( mentioned in the jcl in the post) i am getting the proper output.

output file after sort steps

A2008-01-010000000000000000000 =====>header
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A ==========> Detail Record
T000000000000006 ===========> Trailer Record

But i want to Validate the trailer count of the input file before sort first step(wants to do in DFSORT).

For example in the input file the trailer count(which is record Count) is
000000000000008, i want to check this value against the sort count which is done by DFSORT. If it doesn't Match then the job should fail.

Can it be possible through SORT?

TRAILER1=(C'T',COUNT=(M11,LENGTH=15))

M11===> for the next field pls correct me if i am wrong.

if i want to add the trailer where i will update the 4th field which will start at 60th position then how will be the syntax.


Thank You.
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: Mon Apr 14, 2008 10:33 pm    Post subject:
Reply with quote

Quote:
the Trailer should have the Record Count which is the second field After the Record Type.


Quote:
if i want to add the trailer where i will update the 4th field which will start at 60th position then how will be the syntax.


These two statements contradict each other. It isn't clear what you want the TRAILER record to look like. Will the TRAILER record just have 'T' and the count starting at position 60, or will it have other fields as well (other fields from the input TRAILER record, or constants, or what)? Please show clearly what the trailer record looks like in the input file and what you want it to look like in the output file.

Also, what is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
ashakant4u

New User


Joined: 11 Apr 2008
Posts: 5
Location: pune

PostPosted: Tue Apr 15, 2008 4:44 pm    Post subject: Reply to: Validating the Trailer in DFSORT
Reply with quote

Hi Frank,

Thanks for the quick response.

I just want to know how to validate the trailer which is having the proper Trailer count or not.

As per the calculation if the trailer count is not same as the count done in the sort card then it should abend.

input file is like this:
A2008-01-010000000000000000000 =====>header
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p ==========> Detail Record
T00000000000000800000000000000 ===========> Trailer Record


RECFM=FB,LRECL=1067

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 Apr 15, 2008 9:03 pm    Post subject:
Reply with quote

I don't understand what you want to validate against what.

Quote:
As per the calculation if the trailer count is not same as the count done in the sort card then it should abend


This doesn't make any sense to me.

If you're using DFSORT to create the output count, then DFSORT will give you the correct count based on what you specified. Why would you need to validate anything?
Back to top
View user's profile Send private message
ashakant4u

New User


Joined: 11 Apr 2008
Posts: 5
Location: pune

PostPosted: Tue Apr 15, 2008 9:36 pm    Post subject: Reply to: Validating the Trailer in DFSORT
Reply with quote

Hi Frank,

I am very sorry if it was not clear to you.

My requirement is as below:

1.I am getting an input file from the different program of
RECFM=FB,LRECL=1067.
2. i want to validate the trailer of the input file. The trailer of the input file contains the record type and record count. in the input file first position is the record type.

ex:

input file:
------------

A2008-01-010000000000000000000 =====>header 'A' is the type
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p
DDV00000000000000000000000000A
DDV00000000000000000000000000A
DDV00000000000000000000000000p ==========> Detail Record
T00000000000000800000000000000 ===========> Trailer Record

'A' is for Header Rec Type
'D' is the Detail Rec Type
'T' is the Trailer Rec Type

Record Count is the 2nd field after the Rec Type of the Trailer Record.
Here in this case the Record Count is 000000000000008. Record Count field should have the num of Detail Record.
in this case the trailer Record is having the correct value(000000000000008) in the record count field of the trailer.

Let's say we are getting the input file(having same num of Detail Records) which has REcord Count Value as 000000000000009, which is incorrect, should be 000000000000008.

can it be validated in the DFSORT UTILITY.

If Yes pls let me know.

I hope this time it is little clear.


Thanks.

Regards
AKP
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 Apr 15, 2008 10:44 pm    Post subject:
Reply with quote

I'm not sure DFSORT would be the best way to do that kind of validation since it would be rather tricky:

You'd have to extract each count, combine them in a single record, and do an INCLUDE for count1,EQ,count2. If they're not equal, you'd get zero records and NULLOUT=RC16 with DEBUG ABEND would get you an ABEND.

Seems like a simple program would be easier to set up and use.
Back to top
View user's profile Send private message
ashakant4u

New User


Joined: 11 Apr 2008
Posts: 5
Location: pune

PostPosted: Wed Apr 16, 2008 10:50 am    Post subject: Reply to: Validating the Trailer in DFSORT
Reply with quote

Hi Frank,

Thanks for your reply.

I know simple cobol program can do it but i wanted it to do in DFSORT.


Thank you,

AKP
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: Thu Apr 17, 2008 5:15 am    Post subject:
Reply with quote

Somebody on another help board posed a similar question but with a better example so I responded to it and I thought I'd post it here in case it will help.

Quote:
Besides writing COBOL program, is it possible to use SORT on a job to validate trailer count on a file and return condition codes depending upon if number of detail records matching trailer count or not.

EXAMPLE 1
INPUT FILE:

Code:
1HDR
2DTLAAAAA
2DTLBBBBB
2DTLCCCCC
9TRL  00000003


Number of 2DTL records = 3, count on 9TRL record = 3
==> counts match and return code = 0

EXAMPLE 2
INPUT FILE:

Code:
1HDR
2DTLAAAAA
2DTLBBBBB
2DTLCCCCC
9TRL  00000004



Number of 2DTL records = 3, count on 9TRL record = 4
==> counts mismatch and return code > 0


You can use a DFSORT job like the following to do what you asked for. Note that you need z/OS DFSORT V1R5 to use NULLOUT (it's not supported in DFSORT R14).

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1HDR
2DTLAAAAA
2DTLBBBBB
2DTLCCCCC
9TRL  00000004
/*
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TRL DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=SYM,INCLUDE=(1,1,CH,EQ,C'9'),
    BUILD=(C'OCOUNT,+',7,8,80:X)
  OUTFIL FNAMES=TRL,REMOVECC,NODETAIL,
    INCLUDE=(1,1,CH,EQ,C'2'),
    BUILD=(8X),
    TRAILER1=(COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DUMMY
//SYSIN    DD    *
  OPTION COPY,NULLOUT=RC4
  INCLUDE COND=(1,8,ZD,EQ,OCOUNT)
/*
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Apr 17, 2008 10:32 pm    Post subject:
Reply with quote

ashakant4u,

You can use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0200 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
A2008-01-010000000000000000000 =====>HEADER 'A' IS THE TYPE
DDV00000000000000000000000000A                             
DDV00000000000000000000000000A                             
DDV00000000000000000000000000A                             
DDV00000000000000000000000000A                             
DDV00000000000000000000000000P                             
DDV00000000000000000000000000A                             
DDV00000000000000000000000000A                             
DDV00000000000000000000000000P ==========> DETAIL RECORD   
T00000000000000900000000000000 =========                   
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,15,ZD)),     
         IFTHEN=(WHEN=(1,1,CH,EQ,C'T'),                   
        OVERLAY=(81:+2,SUB,81,15,ZD,M11,LENGTH=15))       
                                                           
  OUTFIL NULLOFL=RC4,INCLUDE=(02,15,ZD,EQ,81,15,ZD)       
/*


Hope this helps...
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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