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

DFSORT OR ICE TOOL


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

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 2:37 pm
Reply with quote

Hi,

I have a requirement where i need to create the audit file and increment it say 00,01,02....till 20 every time a job step runs .

JOB A STEPS :-

In job A we have 3 steps .
STEP 1 _ check for empty or not empty in the input file
STEP2_ if the input file is not empty . Increment a counter in the audit file . The audit file doesn't have any except the count . In our case for the first run if the input file is nonempty the audit file will have one . The file length is say 2 and its ZD.
STEP3_ create a o/p file based on program1.

I am finding a solution for the step2 on incementing an empty audit file.

IS there any option in DFSORT or ICE-TOOL which automatically increment 1 .

Pls help me out with this issue.
Regards,
L.Nethaji
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 Jul 30, 2012 2:53 pm
Reply with quote

I'm not sure what you expect by "automatically".

If you have a single-record file and you need to add one to a value on that file, it is simple. Consult the documentation for ADD.

A two-digit number is going to last you half a year at most, isn't it?

Can't say it is much of an "audit" file to start with. Could be any two bytes of data. Wouldn't satisfy any "audit" I've been involved with... but, "it's the requirement..."
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 3:06 pm
Reply with quote

Bill,

Thanks for the reply .

I am not having any data in the audit file .

Automatically i meant can we insert 0 to the audit file as it will be empty once we create the file . Once created the audit file will be incremented if the STEP1 has a non empty record.

The req is we run a job for 10 countries . Each time it finds data for a country we increment the counter by 1 in 2nd step. So suppose if we have 5 empty input file for 5 countries 5 non empty file for 5 other countries. The counter value will be 5 in the audit file . When we ftp the 5 countries file to unix we sent these audit file which has the counter value of 5 along with that . So the unix checks fr the counter value and no of file it got .So if there is a match it executes there part else it abend .... This is the total requirement.
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 Jul 30, 2012 3:39 pm
Reply with quote

OK, for this I'd think it better to send the "name" of the file (can be a "representative name" in business terms) and the business date/data date of the files (ie the one actually associated with each file).

Just sending a count is not much of a check. "We sent five files" - "We received five files" is no use if all five, or any one of them, are/is wrong.

However, for your organisation that may be by-the-by.

It is not clear to me now how you check each of the 10 files to know how many are empty.

For what you have described, it might be best to have a step which creates your count file with 00 as the value, then you update the count for each "non-empty" file in a seperate step(s).

If you can show a bit more about how the 10 files are identified as containing data or not, a little more flesh can be put on the outline.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Mon Jul 30, 2012 3:43 pm
Reply with quote

you may try below logic

check for empty file set RC and based on RC write some dummy data
in dummy file and then take a record count .

if file empty donot write data to dummy file,skip the step
if file non empty write one record to the file may 1 byte record and after
all is over take the count of record in dummy file.

dummy file should be in disp=MOD

icon_biggrin.gif
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 4:21 pm
Reply with quote

Hi,

Below is the plan i am having to check the empty file

//SYSIN DD *
PRINT INDATASET(INPUT DATA SET NAME) -
CHARACTER COUNT(1).


Here if the return code of this step is 0 this means dataset is not empty. If the return code = 4 then it means its an empty dataset. This also one way of empty dataset verification....

So based on this above step return codei have to execute step2 where i have to increment the counter in the audit file if the return code is 0 else if it 4 i will check all the steps. SAy it ran for the first country say poland and file is ther it increment the counter as 1 . This file will be used by another country say netherland if the netherland input file is ther it will increment the audit file from 1 to 2 ...say way it will run for all the countries one by one and when we send each countires o/p file we send only non empty data along with the audit file which has the count so both the no of files and file count must match,

Pls let me know if u need furthur data.

REgards,
L.Nethaji
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 Jul 30, 2012 4:31 pm
Reply with quote

So, have a step which creats 00 at some logical point before everything starts.

Then you can, in DFSORT if that is your chosen weapon, use ADD to do the addition in a step which is conditional upon the presence of data in each individual country file.

By the time all the countries are processed, or at whatever point you need, the count will represent the number of files with data in.

Make sure you consider how it works with re-runs from failures or necessity.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 30, 2012 4:39 pm
Reply with quote

having one counter to control 10 files is rather short sited.

if one day country 1,2,4 have data and 3 is empty, the counter is 3.

next day, country 2,3,4 have data and 1 is empty, the counter is 3.

what good is the counter?

I realize the most everything in life is dumbed-down to the lowest common denominator,

but why are these files not enveloped with head and trailer,
which includes count.
so that a no-data day would have a trailer with a count of zero.

does not seem to matter what you decide on,
the rocket scientists will screw it up one way or another.
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 5:42 pm
Reply with quote

Dick ,

I got ur question...thanks for the reply

The counter and the no of files received match is done in the unix part .

If the match is equal ( ie as u said the unix received 3 files for 3 countries from mainframe and the counter value is 3 in audit file ....)

They do further processing . If u want more details i can check with them and let u know ...

Regards,
L.Nethaji
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 5:47 pm
Reply with quote

Bill


Thanks a lot for ur reply ...

As per your suggestion i am planning to use the below

OPTION COPY
OUTREC FIELDS=(1:1,4,ZD,ADD,+1,LENGTH=4)


parallely i will check for failures too.

Regards,
L.Nethaji
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 Jul 30, 2012 5:58 pm
Reply with quote

I'd use BUILD not FIELDS (makes no difference that I know of) and not specify the column for the output, as that is where the output is going to start anyway.

Since there are a lot fewer than 999 countries (and territories and othe little bits and pieces) four digits will certainly cover it...

Repeating my earlier point and echoing dbz's, I do think this count gives you little. When it all goes wrong, and Honduras gets the Poland file, it'll be clear to your organisation how limited this "audit" is.
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Mon Jul 30, 2012 6:37 pm
Reply with quote

You may also use the below if needed.

Code:
//STEP EXEC SORT                             
//SYSOUT   DD SYSOUT=*                       
//SORTIN  DD *                               
DATA  AUDIT FILE                             
DATA2 AUDIT FILE                             
//SORTOUT  DD DSN=&&TEMP,DISP=(MOD,PASS,),LRECL=1   
//SYSIN   DD *                               
 OPTION COPY,STOPAFT=1                       
//SS      EXEC PGM=ICETOOL                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG  DD SYSOUT=*                       
//IN2     DD DISP=SHR,DSN=&&TEMP             
//CT2     DD SYSOUT=*                       
//TOOLIN  DD *                               
COUNT FROM(IN2) WRITE(CT2)   



with this you may avoid an RC check.
also this is assuming you dont have a header/trailer, else you may need an omit cond to remove them and then a copy.

Put the first step in a proc and call with 10 different files.
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 6:59 pm
Reply with quote

Hi Knickraj,

Thanks again ..I just want to make sure my understanding is correct.

Code:
//STEP EXEC SORT                             
//SYSOUT   DD SYSOUT=*                       
//SORTIN  DD *                               
DATA  AUDIT FILE                             
DATA2 AUDIT FILE                             
//SORTOUT  DD DSN=&&TEMP,DISP=(MOD,PASS,),LRECL=1   
//SYSIN   DD *                               
 OPTION COPY,STOPAFT=1   

In the above step its says audit file . Audit file i think u meant the country input file . Having that assumption if the input file for a country say poland has data , it will copy the first record to temp file .

In the below step it check for the temp file and write C2 as 1 which is the real audit file ... But how can increment the counter value when it run for the next country .

Code:
//SS      EXEC PGM=ICETOOL                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG  DD SYSOUT=*                       
//IN2     DD DISP=SHR,DSN=&&TEMP             
//CT2     DD SYSOUT=*                       
//TOOLIN  DD *                               
COUNT FROM(IN2) WRITE(CT2)


Code'd
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 Jul 30, 2012 7:13 pm
Reply with quote

The idea is to run the first step for each country file. One record is copied from each and, because of MOD, the &&TEMP file contains one record from each file which has data.

The ICETOOL will then COUNT the records on the temporary dataset.

You could format the count produced for your requirement.

It is an alternative approach. You are currently reading one record with IDCAMS and getting the return-code set for data/no data.

Choose something which best fits the flow of your data and which is easy to understand and maintain.

Again, the clearest way to do it is with headers/trailers on your data so that the integrity of each country file can be verified from the entire set of data in that country file. For an "empty" file, you have a header (with at least "country file reference" and business date/data date) and a trailer showing zero records.
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon Jul 30, 2012 7:59 pm
Reply with quote

Thanks Bill/ Knickraj..


I got your point on the last mail . I will try the inputs you gave me and work on it . I will give you a reply if i face any issues.

Thanks fr your great time .

L.Nethaji
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Error while running web tool kit REXX... CLIST & REXX 5
Search our Forums:

Back to Top